File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616defined ('APPPATH ' ) || define ('APPPATH ' , realpath ($ paths ->appDirectory ) . DIRECTORY_SEPARATOR );
1717defined ('WRITEPATH ' ) || define ('WRITEPATH ' , realpath ($ paths ->writableDirectory ) . DIRECTORY_SEPARATOR );
1818defined ('SYSTEMPATH ' ) || define ('SYSTEMPATH ' , realpath ($ paths ->systemDirectory ) . DIRECTORY_SEPARATOR );
19+ defined ('VIEWPATH ' ) || define ('VIEWPATH ' , realpath ($ paths ->viewDirectory ) . DIRECTORY_SEPARATOR );
1920defined ('ROOTPATH ' ) || define ('ROOTPATH ' , realpath (APPPATH . '../ ' ) . DIRECTORY_SEPARATOR );
2021defined ('CIPATH ' ) || define ('CIPATH ' , realpath (SYSTEMPATH . '../ ' ) . DIRECTORY_SEPARATOR );
2122defined ('FCPATH ' ) || define ('FCPATH ' , realpath (PUBLICPATH ) . DIRECTORY_SEPARATOR );
2223defined ('TESTPATH ' ) || define ('TESTPATH ' , realpath (HOMEPATH . 'tests/ ' ) . DIRECTORY_SEPARATOR );
2324defined ('SUPPORTPATH ' ) || define ('SUPPORTPATH ' , realpath (TESTPATH . '_support/ ' ) . DIRECTORY_SEPARATOR );
2425defined ('COMPOSER_PATH ' ) || define ('COMPOSER_PATH ' , realpath (HOMEPATH . 'vendor/autoload.php ' ));
26+ defined ('VENDORPATH ' ) || define ('VENDORPATH ' , realpath (HOMEPATH . 'vendor ' ) . DIRECTORY_SEPARATOR );
2527
2628// Load Common.php from App then System
2729if (file_exists (APPPATH . 'Common.php ' ))
Original file line number Diff line number Diff line change @@ -7,4 +7,26 @@ public function testNew()
77 $ actual = new Exceptions (new \Config \Exceptions (), \Config \Services::request (), \Config \Services::response ());
88 $ this ->assertInstanceOf (Exceptions::class, $ actual );
99 }
10+
11+ /**
12+ * @dataProvider dirtyPathsProvider
13+ */
14+ public function testCleanPaths ($ file , $ expected )
15+ {
16+ $ this ->assertEquals ($ expected , Exceptions::cleanPath ($ file ));
17+ }
18+
19+ public function dirtyPathsProvider ()
20+ {
21+ $ ds = DIRECTORY_SEPARATOR ;
22+
23+ return [
24+ [APPPATH . 'Config ' . $ ds . 'App.php ' , 'APPPATH ' . $ ds . 'Config ' . $ ds . 'App.php ' ],
25+ [APPPATH . 'Views ' . $ ds . 'welcome_message.php ' , 'VIEWPATH ' . $ ds . 'welcome_message.php ' ],
26+ [SYSTEMPATH . 'CodeIgniter.php ' , 'SYSTEMPATH ' . $ ds . 'CodeIgniter.php ' ],
27+ [VIEWPATH . 'errors ' . $ ds . 'html ' . $ ds . 'error_exception.php ' , 'VIEWPATH ' . $ ds . 'errors ' . $ ds . 'html ' . $ ds . 'error_exception.php ' ],
28+ [VENDORPATH . 'autoload.php ' , 'VENDORPATH ' . $ ds . 'autoload.php ' ],
29+ [FCPATH . 'index.php ' , 'FCPATH ' . $ ds . 'index.php ' ],
30+ ];
31+ }
1032}
You can’t perform that action at this time.
0 commit comments