dox Executable Documentation

Derive actions from methods

Instead of defining a class for each Action, they can be derived from methods signatures.

Then hanlder of those actions then destructs the objects onto the parameters.

Construct from method

When I construct an action from the method 'someMethod' of 'construct\\SomeClass'
Then the action should have the properties array('one', 'two')
Then the action should have the name 'Some Method'
Then the action should have the class 'construct\\SomeClass__someMethod'

Invoke method with arguments of action

When I construct an action from the method 'someMethod' of 'construct\\SomeClass'
When I execute the action with array('one' => 'uno', 'two' => '2001-02-03')
Then it should return 'uno 2001-02-03'

Determine required properties

When I construct an action from the method 'someMethod' of 'construct\\SomeClass'
Then property 'one' should be required
Then property 'two' should be optional

Show preparation form of derived action

When I construct an action from the method 'someMethod' of 'construct\\SomeClass'
When I show the perparation form of this action
Then the action should be 'construct\\SomeClass__someMethod'

Determine argument types

When I construct an action from the method 'someMethod' of 'construct\\SomeClass'
Then 'one' should have the type StringType::class
Then 'two' should have the type NullableType::class

Abstract method with implementation provided by factory

Given the abstract class 'inherited\\AbstractClass' with the body ' abstract function someMethod(); '
Given the class 'inherited\\Implementation' extending 'AbstractClass' with the body ' function someMethod() { return "found me"; } '
Given I set an instance of 'inherited\\Implementation' as singleton for 'inherited\\AbstractClass'
When I construct an action from the method 'someMethod' of 'inherited\\AbstractClass'
When I execute the action with array()
Then it should return 'found me'