dox Executable Documentation

Show properties

No properties

Given I added the closure function () { return new \StdClass(); } as handler for 'MyAction'
When I show the results of 'MyAction'
Then there should be no properties

Display dynamic properties

Given I added the closure function () { $object = new \StdClass(); $object->propertyOne = 'valueOne'; $object->propertyTwo = 'valueTwo'; return $object; } as handler for 'MyAction'
When I show the results of 'MyAction'
Then there should be 2 properties
Then property 1 should have the name 'propertyOne' and caption 'valueOne'
Then property 1 should have the label 'Property One'

Read properties from getters

Given the class 'getters\\MyClass' with the body ' public $zero = "null"; function getOne() { return "uno";} function getTwo() { return "dos"; } function setThree() { } private function getNotMe() {} '
Given the class 'getters\\MyHandler' with the body ' function myAction() { return new MyClass(); } '
Given I added the class 'getters\\MyHandler' as handler for 'MyAction'
When I show the results of 'MyAction'
Then there should be 3 properties
Then property 1 should have the name 'zero' and caption 'null'
Then property 2 should have the name 'one' and caption 'uno'
Then property 3 should have the name 'two' and caption 'dos'

Property with boolean values

Given the class 'booleanValue\\MyClass' with the body ' public $true = true; public $false = false; '
Given the class 'booleanValue\\MyHandler' with the body ' function myAction() { return new MyClass(); } '
Given I added the class 'booleanValue\\MyHandler' as handler for 'MyAction'
When I show the results of 'MyAction'
Then there should be 2 properties
Then property 1 should have the name 'true' and caption 'Yes'
Then property 2 should have the name 'false' and caption 'No'

Render object properties

Given I added the closure function () { $object = new \StdClass(); $object->one = new \DateTime('2012-03-04 15:16'); return $object; } as handler for 'MyAction'
Given I registered an entity representer for 'DateTime'
Given I have the the renderer function (\DateTime $d) { return $d->format('Y-m-d H:i'); } for 'DateTime'
When I show the results of 'MyAction'
Then there should be 1 properties
Then property 1 should have the name 'one' and caption '2012-03-04 15:16'

Show collection object property

Given the class 'collectionObject\\SomeEntity' with the body ' function getArray() { return new \\watoki\\collections\\Liste([ ["foo" => "bar"], ["bar" => "baz"], ]); } '
Given the class 'collectionObject\\MyHandler' with the body ' function myAction() { return new SomeEntity(); } '
Given I added the class 'collectionObject\\MyHandler' as handler for 'MyAction'
When I show the results of 'MyAction'
Then there should be 1 properties
Then property 1 should have 2 value
Then property 1 should have value 1 with the caption 'Array( [foo] => bar)'

Show actions for properties

Given the class 'properties\\OtherEntity' with the body ' public $id = "property"; '
Given the class 'properties\\SomeEntity' with the body ' public $id = "entity"; function __construct($one) { $this->one = $one; } '
Given the class 'properties\\MyHandler' with the body ' function myAction() { return new SomeEntity(new OtherEntity()); } '
Given I added the class 'properties\\MyHandler' as handler for 'MyAction'
Given I registered an entity representer for 'properties\\OtherEntity'
Given I added the action 'SomeAction' to the representer of 'properties\\OtherEntity'
Given I added the action 'SomeAnother' to the representer of 'properties\\OtherEntity'
When I show the results of 'MyAction'
Then there should be 2 properties
Then property 1 should have 2 actions
Then property 1 should have action 1 with the caption 'Some Action'
Then property 1 should have action 1 with the link target 'execute?action=SomeAction&args[id]=property'
Then property 1 should have action 2 with the caption 'Some Another'

Property actions

Given the class 'propertyActions\\SomeEntity' with the body ' public $id = "someID"; function __construct($other) { $this->other = $other; } '
Given the class 'propertyActions\\OtherEntity' with the body ' public $id = "otherID"; '
Given the class 'propertyActions\\MyHandler' with the body ' function myAction() { return new SomeEntity(new OtherEntity()); } '
Given I added the class 'propertyActions\\MyHandler' as handler for 'MyAction'
Given the class 'propertyActions\\PropertyAction'
Given the class 'propertyActions\\PropertyAnother'
Given I registered an entity representer for 'propertyActions\\SomeEntity'
Given I added an action 'propertyActions\\PropertyAction' for the property 'other' of 'propertyActions\\SomeEntity'
Given I added an action 'propertyActions\\PropertyAnother' for the property 'other' of 'propertyActions\\SomeEntity'
When I show the results of 'MyAction'
Then there should be 2 properties
Then property 1 should have action 1 with the caption 'Property Action'
Then property 1 should have action 1 with the link target 'execute?action=propertyActions%5CPropertyAction&args[id]=someID&args[object]=otherID'
Then property 1 should have action 2 with the caption 'Property Another'
Then property 1 should have action 2 with the link target 'execute?action=propertyActions%5CPropertyAnother&args[id]=someID&args[object]=otherID'

Show array property

Given the class 'arrayProperty\\SomeEntity' with the body ' function getArray() { return [ new \\DateTime("2001-01-01"), new \\DateTime("2002-02-02") ]; } '
Given the class 'arrayProperty\\MyHandler' with the body ' function myAction() { return new SomeEntity(); } '
Given I added the class 'arrayProperty\\MyHandler' as handler for 'MyAction'
Given I registered an entity representer for \DateTime::class
Given I have the the renderer function (\DateTime $d) { return $d->format('Y-m-d H:i'); } for \DateTime::class
When I show the results of 'MyAction'
Then there should be 1 properties
Then property 1 should have the name 'array'
Then property 1 should have 2 value
Then property 1 should have value 1 with the caption '2001-01-01 00:00'
Then property 1 should have value 2 with the caption '2002-02-02 00:00'

Property actions of array property

Given the class 'arrayPropertyActions\\SomeEntity' with the body ' public $id = "someID"; function __construct($other) { $this->other = $other; } '
Given the class 'arrayPropertyActions\\OtherEntity' with the body ' public $id = "otherID"; function __construct($id) { $this->id = $id; } '
Given the class 'arrayPropertyActions\\MyHandler' with the body ' function myAction() { return new SomeEntity([ new OtherEntity(42), new OtherEntity(73) ]); } '
Given I added the class 'arrayPropertyActions\\MyHandler' as handler for 'MyAction'
Given the class 'arrayPropertyActions\\PropertyAction'
Given the class 'arrayPropertyActions\\PropertyAnother'
Given I registered an entity representer for 'arrayPropertyActions\\SomeEntity'
Given I added an action 'arrayPropertyActions\\PropertyAction' for the property 'other' of 'arrayPropertyActions\\SomeEntity'
Given I added an action 'arrayPropertyActions\\PropertyAnother' for the property 'other' of 'arrayPropertyActions\\SomeEntity'
When I show the results of 'MyAction'
Then there should be 2 properties
Then value 1 of property 1 should have action 1 with the link target 'execute?action=arrayPropertyActions%5CPropertyAction&args[id]=someID&args[object]=42'
Then value 2 of property 1 should have action 1 with the link target 'execute?action=arrayPropertyActions%5CPropertyAction&args[id]=someID&args[object]=73'

background

Given the class 'MyAction'