@@ -51,64 +51,67 @@ protected function setUp(): void
5151 $ this ->locator = new FileLocator ($ autoloader );
5252 }
5353
54- public function testLocateFileWorksWithLegacyStructure ()
54+ public function testLocateFileNotNamespacedFindsInAppDirectory ()
5555 {
56- $ file = 'Controllers/Home ' ;
56+ $ file = 'Controllers/Home ' ; // not namespaced
5757
5858 $ expected = APPPATH . 'Controllers/Home.php ' ;
5959
6060 $ this ->assertSame ($ expected , $ this ->locator ->locateFile ($ file ));
6161 }
6262
63- public function testLocateFileWithLegacyStructureNotFound ()
63+ public function testLocateFileNotNamespacedNotFound ()
6464 {
65- $ file = 'Unknown ' ;
65+ $ file = 'Unknown ' ; // not namespaced
6666
6767 $ this ->assertFalse ($ this ->locator ->locateFile ($ file ));
6868 }
6969
70- public function testLocateFileWorksInApplicationDirectory ()
70+ public function testLocateFileNotNamespacedFindsWithFolderInAppDirectory ()
7171 {
72- $ file = 'welcome_message ' ;
72+ $ file = 'welcome_message ' ; // not namespaced
7373
7474 $ expected = APPPATH . 'Views/welcome_message.php ' ;
7575
7676 $ this ->assertSame ($ expected , $ this ->locator ->locateFile ($ file , 'Views ' ));
7777 }
7878
79- public function testLocateFileWorksInApplicationDirectoryWithoutFolder ()
79+ public function testLocateFileNotNamespacedFindesWithoutFolderInAppDirectory ()
8080 {
81- $ file = 'Common ' ;
81+ $ file = 'Common ' ; // not namespaced
8282
8383 $ expected = APPPATH . 'Common.php ' ;
8484
8585 $ this ->assertSame ($ expected , $ this ->locator ->locateFile ($ file ));
8686 }
8787
88- public function testLocateFileWorksInNestedApplicationDirectory ()
88+ public function testLocateFileNotNamespacedWorksInNestedAppDirectory ()
8989 {
90- $ file = 'Controllers/Home ' ;
90+ $ file = 'Controllers/Home ' ; // not namespaced
9191
9292 $ expected = APPPATH . 'Controllers/Home.php ' ;
9393
94+ // This works because $file contains `Controllers`.
9495 $ this ->assertSame ($ expected , $ this ->locator ->locateFile ($ file , 'Controllers ' ));
9596 }
9697
97- public function testLocateFileReplacesFolderName ()
98+ public function testLocateFileWithFolderNameInFile ()
9899 {
99100 $ file = '\App\Views/errors/html/error_404.php ' ;
100101
101102 $ expected = APPPATH . 'Views/errors/html/error_404.php ' ;
102103
104+ // This works because $file contains `Views`.
103105 $ this ->assertSame ($ expected , $ this ->locator ->locateFile ($ file , 'Views ' ));
104106 }
105107
106- public function testLocateFileReplacesFolderNameLegacy ()
108+ public function testLocateFileNotNamespacedWithFolderNameInFile ()
107109 {
108- $ file = 'Views/welcome_message.php ' ;
110+ $ file = 'Views/welcome_message.php ' ; // not namespaced
109111
110112 $ expected = APPPATH . 'Views/welcome_message.php ' ;
111113
114+ // This works because $file contains `Views`.
112115 $ this ->assertSame ($ expected , $ this ->locator ->locateFile ($ file , 'Views ' ));
113116 }
114117
@@ -118,6 +121,7 @@ public function testLocateFileCanFindNamespacedView()
118121
119122 $ expected = APPPATH . 'Views/errors/html/error_404.php ' ;
120123
124+ // The namespace `Errors` (APPPATH . 'Views/errors') + the folder (`html`) + `error_404`
121125 $ this ->assertSame ($ expected , $ this ->locator ->locateFile ($ file , 'html ' ));
122126 }
123127
0 commit comments