dox Executable Documentation

Prepare actions

Actions can have properties which have to be filled before executing the Action.

This is done by assigning request parameters to the properties of the Action. Missing properties are requested from the user. Properties are determined with public instance variables and setter methods.

No result if action cannot be created

When I execute the action 'ComplexAction'
Then it should show no result
Then the field 'one' should have no value
Then the field 'two' should have the value 'dos'
Then the field 'three' should have the value 'tres'
Then the field 'four' should have no value

Show result if action can be created

Given the action argument 'one' is 'uno'
When I execute the action 'ComplexAction'
Then the result should be shown
Then the field 'one' should have the value 'uno'

Keep arguments in form

Given the action argument 'one' is 'uno'
Given the action argument 'two' is 'dos'
When I execute the action 'ComplexAction'
Then the field 'two' should have the value 'dos'

Hide action form if it has no fields

Given the class 'EmptyAction'
Given I set an empty handler for 'EmptyAction'
When I execute the action 'EmptyAction'
Then the action form should not be there

Inflate arguments

Given the class 'inflateArgs\\InflatableAction' with the body ' public $inflateMe; '
Given I added the closure function () { return new \StdClass(); } as handler for 'inflateArgs\\InflatableAction'
Given the class 'inflateArgs\\MyHandler' with the body ' public static $action; public function inflatableAction($action) { self::$action = $action; return new \\StdClass(); } '
Given the class 'inflateArgs\\MySpecialField' extending '\\watoki\\qrator\\form\\Field' with the body ' public function render() {} public function inflate($value) { return new \\DateTime($value); } '
Given I added the class 'inflateArgs\\MyHandler' as handler for 'inflateArgs\\InflatableAction'
Given the action argument 'inflateMe' is '2012-03-04 15:16'
Given I registered an action representer for 'inflateArgs\\InflatableAction'
Given I set the field 'inflateMe' of 'inflateArgs\\InflatableAction' to be an instance of 'inflateArgs\\MySpecialField'
When I execute the action 'inflateArgs\\InflatableAction'
Then 'inflateArgs\\MyHandler::$action->inflateMe instanceof \\DateTime' should be true
Then 'inflateArgs\\MyHandler::$action->inflateMe->getTimestamp()' should be 1330874160

background

Given the class 'ComplexAction' with the body ' function __construct($one, $two = "dos") { $this->one = $one; $this->two = $two; } public $three = "tres"; public $four; '
Given I added the closure function () { return new \StdClass(); } as handler for 'ComplexAction'