@@ -21,6 +21,9 @@ class SectionTest extends \PHPFUI\HTMLUnitTester\Extensions
2121 */
2222 public function setUp () : void
2323 {
24+ // give us easier to debug line numbers
25+ \PHPFUI \Page::setDebug (1 );
26+
2427 $ rdi = new \RecursiveDirectoryIterator ('src/PHPFUI/InstaDoc/Section ' );
2528 $ iterator = new \RecursiveIteratorIterator ($ rdi , \RecursiveIteratorIterator::CHILD_FIRST );
2629
@@ -61,5 +64,45 @@ public function testSectionsGenerateValidHTML() : void
6164 }
6265 }
6366
67+ public function testClassesGenerateValidHTML () : void
68+ {
69+ foreach ($ this ->sections as $ section )
70+ {
71+ $ this ->controller ->setParameters ($ this ->controller ->getClassParts ($ section ));
72+
73+ foreach ([\PHPFUI \InstaDoc \Controller::DOC_PAGE , \PHPFUI \InstaDoc \Controller::FILE_PAGE , \PHPFUI \InstaDoc \Controller::GIT_PAGE ] as $ page )
74+ {
75+ $ this ->controller ->setParameter (\PHPFUI \InstaDoc \Controller::PAGE , $ page );
76+ $ page = $ this ->controller ->display ();
77+ $ this ->assertValidHtml ("{$ page }" );
78+ $ this ->assertNotWarningHtml ("{$ page }" );
79+ }
80+
81+ // should just display landing page
82+ $ this ->controller ->setParameter (\PHPFUI \InstaDoc \Controller::PAGE , '' );
83+ $ this ->controller ->setParameter (\PHPFUI \InstaDoc \Controller::CLASS_NAME , '' );
84+ $ page = $ this ->controller ->display ();
85+ $ this ->assertValidHtml ("{$ page }" );
86+ $ this ->assertNotWarningHtml ("{$ page }" );
87+ }
88+ }
89+
90+ public function testHomePage () : void
91+ {
92+ // should just display home page
93+ $ this ->controller ->setParameters ([]);
94+ $ page = $ this ->controller ->display ();
95+ $ this ->assertValidHtml ("{$ page }" );
96+ $ this ->assertNotWarningHtml ("{$ page }" );
97+ }
98+
99+ public function testInvalidPage () : void
100+ {
101+ $ this ->controller ->setParameters ($ this ->controller ->getClassParts ('\\Fred \\Flintstone \\Bedrock ' ));
102+ $ page = $ this ->controller ->display ();
103+ $ this ->assertValidHtml ("{$ page }" );
104+ $ this ->assertNotWarningHtml ("{$ page }" );
105+ }
106+
64107 }
65108
0 commit comments