dox Executable Documentation

Property injection

Inject public property

Given the class definition ' class PublicProperty { /** * @var StdClass <- */ protected $foo; /** * @var StdClass <- */ private $bar; } '
When I get 'PublicProperty' from the factory
$this->fix->theTheProperty_ShouldBeAnInstanceOf('foo', 'StdClass');
$this->fix->theTheProperty_ShouldBeAnInstanceOf('bar', 'StdClass');

Protected and private properties

Given the class definition ' class ProtectedAndPrivateProperty { /** * @var StdClass <- */ public $foo; } '
When I get 'ProtectedAndPrivateProperty' from the factory
$this->fix->theTheProperty_ShouldBeAnInstanceOf('foo', 'StdClass');
$this->fix->theTheProperty_ShouldBeAnInstanceOf('foo', 'StdClass');

Annotation instead of marker

Given the class definition ' class AnnotatedProperty { /** * @inject * @var StdClass */ public $foo; /** * @var StdClass */ public $bar; } '
Given only properties with the annotation '@inject' should be injected
When I get 'AnnotatedProperty' from the factory
$this->fix->theTheProperty_ShouldBeAnInstanceOf('foo', 'StdClass');
Then the the property 'bar' of the object should be null

Dont inject properties with values

Given the class definition ' class PropertyWithValue { /** @var StdClass <- */ public $foo = "not null"; /** @var StdClass <- */ public $bar; } '
When I get 'PropertyWithValue' from the factory
Then the the property 'foo' of the object should be 'not null'
Then the the property 'bar' of the object should be an instance of 'StdClass'

Method injection

Given the class definition 'class MethodInjection { public function inject(StdClass $one) { $this->one = $one; } }'
When I get 'MethodInjection' from the factory
Then the the property 'one' of the object should be an instance of 'StdClass'

In parent aliased type hint

Given the class definition 'namespace here; class MyAliasedClass {}'
Given the class definition 'use here\\MyAliasedClass; class AliasingParent { /** @var MyAliasedClass <- */ public $foo; }'
Given the class definition 'class AliasingSubClass extends AliasingParent {}'
When I get 'AliasingSubClass' from the factory
Then the the property 'foo' of the object should be an instance of 'here\\MyAliasedClass'