dox Executable Documentation

Render specification

All comments are interpreted as markdown and rendered as HTML.

Empty specification

Given the project 'MyProject'
Given the project 'MyProject' has the spec folder 'mySpec'
Given the file 'user/projects/MyProject/mySpec/SomeSpecificationTest.php' with content ' <?php class SomeSpecificationTest {}'
When I request the resource at 'projects/MyProject/specs/SomeSpecification'
Then the response should contain ' "specification": { "name": "Some specification", "description": null, "scenario": [] } '

Specification with description and methods

Given the project 'MyProject'
Given the project 'MyProject' has the spec folder 'mySpec'
Given the file 'user/projects/MyProject/mySpec/SpecificationTest.php' with content ' <?php /** * This is some *description* * * @property ignore this */ class SpecificationTest { /** * Description of *scenario* */ public function testSomeThings() { // Just *some* **comment** $andCode = 1 + 1; } /** * Method *description* */ public function someMethod() { $code = 1; } }'
When I request the resource at 'projects/MyProject/specs/Specification'
Then 'specification/name' should be 'Specification'
Then 'specification/description' should be '<p>This is some <em>description</em></p>'
Then 'specification/scenario' should have the size 1
Then 'specification/scenario/0/name' should be 'Some things'
Then 'specification/scenario/0/description' should be '<p>Description of <em>scenario</em></p>'
Then 'specification/scenario/0/content' should be ' <p>Just <em>some</em> <strong>comment</strong></p> <pre><code>$andCode = 1 + 1;</code></pre>'
Then 'specification/method' should have the size 1
Then 'specification/method/0/name' should be 'someMethod'
Then 'specification/method/0/description' should be '<p>Method <em>description</em></p>'
Then 'specification/method/0/content' should be '<pre><code>$code = 1;</code></pre>'

Render steps

Given the requested format is 'html'
Given the project 'YourProject'
Given the project 'YourProject' has the spec folder 'yourSpec'
Given the file 'user/projects/YourProject/yourSpec/SpecificationTest.php' with content ' <?php class SpecificationTest { public function testSomeThings() { $this->fix->given_Has_Cows("Bart", 2); $this->whenSomethingHappens(); $this->thenItShouldBe("OK"); } }'
When I request the resource at 'projects/YourProject/specs/Specification'
Then the response should contain the text '<div class="steps"> <div class="step-group"> <div title="$this-&gt;fix-&gt;given_Has_Cows(\'Bart\', 2)" class="step">Given <span class="arg">\'Bart\'</span> has <span class="arg">2</span> cows</div> </div> <div class="step-group"> <div title="$this-&gt;whenSomethingHappens()" class="step">When something happens</div> </div> <div class="step-group"> <div title="$this-&gt;thenItShouldBe(\'OK\')" class="step">Then it should be <span class="arg">\'OK\'</span></div> </div> </div>'

Html entities in code

Given the requested format is 'html'
Given the project 'project'
Given the file 'user/projects/project/spec/SpecificationTest.php' with content ' <?php class SpecificationTest { public function testSomeThings() { $code = "<div>Some <em>HTML</em></div>"; } }'
When I request the resource at 'projects/project/specs/Specification'
Then the response should contain the text '&lt;div&gt;Some &lt;em&gt;HTML&lt;/em&gt;&lt;/div&gt;'

Html entities in steps

Given the requested format is 'html'
Given the project 'project'
Given the file 'user/projects/project/spec/SpecificationTest.php' with content ' <?php class SpecificationTest { public function testSomeThings() { $this->givenSomeHtml("<div>Some <em>HTML</em></div>"); } }'
When I request the resource at 'projects/project/specs/Specification'
Then the response should contain the text '$this-&gt;givenSomeHtml(\'&lt;div&gt;Some &lt;em&gt;HTML&lt;/em&gt;&lt;/div&gt;\')'
Then the response should contain the text '<span class="arg">\'&lt;div&gt;Some &lt;em&gt;HTML&lt;/em&gt;&lt;/div&gt;\'</span>'