Blog posts tagged with dependencyinjection
Mocking Symfony Container services in Behat scenarios with Mockery
Mocking objects in unit tests is pretty straight forward as every object used in a test case is usually created in a scope of one test class. In functional tests it's a bit harder since we either don't have full control over objects being created or it's simply too laborious to mock half the framework. Instead of functional tests I'm using Behat. In the context of this blog post it satisfies the same need - verifies the external behavior of an application.
Managing object creation in PHP with the Symfony2 Dependency Injection component
Symfony's DependencyInjection component is a PHP implementation of a Service Container, or as others like to call it, a Dependency Injection Container (DIC). The component also provides useful tools for handling service definitions, like XML loaders or dumpers.


















