dox Executable Documentation

Navigation

dox is supposed to be a browser so we need some links forth and back

Root redirects to home

When I request the resource at ''
Then I should be redirected to 'http://dox/home'

Project list on home page

Given the project 'ProjectOne'
Given the project 'ProjectTwo'
Given the project 'ProjectThree'
When I request the resource at 'home'
Then 'project' should have the size 3
Then 'project/0/name' should be 'ProjectOne'
Then 'project/0/href' should be 'http://dox/projects/ProjectOne'
Then 'project/1/name' should be 'ProjectTwo'
Then 'project/1/href' should be 'http://dox/projects/ProjectTwo'
Then 'project/2/name' should be 'ProjectThree'
Then 'project/2/href' should be 'http://dox/projects/ProjectThree'

Show project description in project list

Given the project 'SomeProject'
Given the file 'user/projects/SomeProject/composer.json' with content '{ "name": "Some cool project", "description": "A short description of this project" }'
When I request the resource at 'home'
Then 'project/0/description' should be 'A short description of this project'

Navigation in project resource

Given the project 'MyProject'
Given the file 'user/projects/MyProject/spec/OneTest.php'
Given the file 'user/projects/MyProject/spec/TwoTest.php'
Given the file 'user/projects/MyProject/spec/Three.php'
Given the file 'user/projects/MyProject/spec/a/AOneTest.php'
Given the file 'user/projects/MyProject/spec/a/ATwoTest.php'
Given the file 'user/projects/MyProject/spec/a/b/ABTest.php'
Given the file 'user/projects/MyProject/spec/c/COneTest.php'
When I request the resource at 'projects/MyProject'
Then 'navigation/name' should be 'MyProject'
Then 'navigation/folder' should have the size 3
Then 'navigation/folder/0/name' should be 'a'
Then 'navigation/folder/0/specification' should have the size 2
Then 'navigation/folder/0/specification/0/name' should be 'A one'
Then 'navigation/folder/0/specification/0/href' should be 'http://dox/projects/MyProject/specs/a__AOne'
Then 'navigation/folder/1/name' should be 'a/b'
Then 'navigation/folder/1/specification/0/href' should be 'http://dox/projects/MyProject/specs/a__b__AB'
Then 'navigation/folder/2/name' should be 'c'
Then 'navigation/specification' should have the size 2
Then 'navigation/specification/0/name' should be 'One'
Then 'navigation/specification/0/href' should be 'http://dox/projects/MyProject/specs/One'
Then 'navigation/specification/1/name' should be 'Two'

Render readme in project page

Given the project 'MyProject'
Given the file 'user/projects/MyProject/spec/OneTest.php'
Given the file 'user/projects/MyProject/readme.md' with content 'Some *markdown* text.'
When I request the resource at 'projects/MyProject'
Then 'readme/text' should be '<p>Some <em>markdown</em> text.</p>'

Uppercase

Given the project 'Uppercase'
Given the file 'user/projects/Uppercase/spec/OneTest.php'
Given the file 'user/projects/Uppercase/README.md' with content 'Found'
When I request the resource at 'projects/Uppercase'
Then 'readme/text' should be '<p>Found</p>'

Mixed case and .markdown extension

Given the project 'MixedCase'
Given the file 'user/projects/MixedCase/spec/OneTest.php'
Given the file 'user/projects/MixedCase/Readme.markdown' with content 'Found'
When I request the resource at 'projects/MixedCase'
Then 'readme/text' should be '<p>Found</p>'

Not markdown format

Given the project 'NoReadme'
Given the file 'user/projects/NoReadme/spec/OneTest.php'
Given the file 'user/projects/NoReadmeCase/Readme' with content 'Found'
When I request the resource at 'projects/NoReadme'
Then 'readme' should be null

Show description of specification in project home

Given the project 'MyProject'
Given the file 'user/projects/MyProject/spec/OneTest.php' with content '<?php /** * Description of this *specification* * in two lines */ class OneTest {} '
Given the file 'user/projects/MyProject/spec/a/TwoTest.php' with content '<?php /** * Description of [that](http://example.com) *specification* */ class TwoTest {} '
When I request the resource at 'projects/MyProject'
Then 'navigation/specification/0/description' should be '<p>Description of this <em>specification</em> in two lines</p>'
Then 'navigation/folder/0/specification/0/description' should be '<p>Description of <a href="http://example.com">that</a> <em>specification</em></p>'

Deep specification url

Given the project 'MyProject'
Given the file 'user/projects/MyProject/spec/a/b/c/SomeTest.php' with content ' <?php class SomeTest {} '
When I request the resource at 'projects/MyProject/specs/a__b__c__Some'
Then the response should contain the text ' "specification": { "name": "Some"'

File name consisting of only suffix

Given the project 'MyProject'
Given the file 'user/projects/MyProject/spec/Test.php' with content ' <?php class SomeTest {} '
When I request the resource at 'projects/MyProject'
Then the response should contain '"specification": []'

Project in non default folder

Given the project 'SomeProject'
Given the project 'SomeProject' is in 'some/other/folder'
Given the file 'some/other/folder/spec/SomeSpecificationTest.php'
When I request the resource at 'projects/SomeProject'
Then the response should contain the text '"name": "Some specification"'

Navigation in specification resource

Given the project 'MyProject'
Given the file 'user/projects/MyProject/spec/OneTest.php' with content '<?php class OneTest {}'
Given the file 'user/projects/MyProject/spec/TwoTest.php' with content '<?php class TwoTest {}'
When I request the resource at 'projects/MyProject/specs/One'
Then 'navigation/folder' should have the size 0
Then 'navigation/specification' should have the size 2

Skip empty folders

Given the project 'MyProject'
Given the file 'user/projects/MyProject/spec/a/Ignored.php'
Given the file 'user/projects/MyProject/spec/a/b/IgnoredAsWell.php'
Given the file 'user/projects/MyProject/spec/c/OneTest.php'
When I request the resource at 'projects/MyProject'
Then 'navigation/folder' should have the size 1
Then 'navigation/folder/0/name' should be 'c'

Link back in specification

Given the project 'project'
Given the file 'user/projects/project/spec/OneTest.php' with content '<?php class SomeSpecClass {}'
When I request the resource at 'projects/project/specs/One'
Then 'back/href' should be 'http://dox/projects/project'

Link back in project

Given the project 'project'
Given the folder 'user/projects/project/spec'
When I request the resource at 'projects/project'
Then 'back/href' should be 'http://dox/home'