dox Executable Documentation

Provider

Find provider directly

Given the provider 'SingleMindedProvider' providing 'return json_decode(\'{"nothing":"just this"}\');'
Given I have set 'SingleMindedProvider' to provide for 'MyClass'
When I get 'MyClass' from the factory
Then the object should be an instance of 'stdClass'
Then the the property 'nothing' of the object should be 'just this'

Find base provider

Given the class definition ' class BaseClass {} '
Given the class definition ' class SubClass extends BaseClass {} '
Given the provider 'BaseProvider' providing '$o = new $class; $o->provided = "yes"; return $o;'
Given I have set 'BaseProvider' to provide for 'BaseClass'
When I get 'SubClass' from the factory
Then the object should be an instance of 'SubClass'
Then the the property 'provided' of the object should be 'yes'

Find specific provider first

Given the class definition ' class Base2Class {} '
Given the class definition ' class Sub2Class extends BaseClass {} '
Given the provider 'LastProvider' providing '$o = new $class; $o->provided = "last"; return $o;'
Given I have set 'LastProvider' to provide for 'Base2Class'
Given the provider 'FirstProvider' providing '$o = new $class; $o->provided = "first"; return $o;'
Given I have set 'FirstProvider' to provide for 'Sub2Class'
When I get 'Sub2Class' from the factory
Then the object should be an instance of 'Sub2Class'
Then the the property 'provided' of the object should be 'first'

Normalize class name

Given the provider 'JustAProvide' providing 'return json_decode(\'{"nothing":"just this"}\');'
Given I have set 'JustAProvide' to provide for '\\My\\Class'
When I get 'my\\class' from the factory
Then the object should be an instance of 'stdClass'
Then the the property 'nothing' of the object should be 'just this'