44 * Test: Nette\Loaders\RobotLoader basic usage.
55 */
66
7- use Nette \Loaders \RobotLoader ,
8- Nette \Caching \Storages \DevNullStorage ,
9- Tester \Assert ;
7+ use Nette \Loaders \RobotLoader ;
8+ use Nette \Caching \Storages \DevNullStorage ;
9+ use Tester \Assert ;
1010
1111
1212require __DIR__ . '/../bootstrap.php ' ;
@@ -18,24 +18,28 @@ $loader->addDirectory(__DIR__ . '/files');
1818$ loader ->addDirectory (__DIR__ . '/files/ ' ); // purposely doubled
1919$ loader ->addDirectory (__DIR__ . '/file/interface.php ' ); // as file
2020$ loader ->addDirectory (__DIR__ . '/file/class.const.php ' );
21- if (PHP_VERSION_ID >= 50400 ) $ loader ->addDirectory (__DIR__ . '/file/trait.php ' );
21+ if (PHP_VERSION_ID >= 50400 ) {
22+ $ loader ->addDirectory (__DIR__ . '/file/trait.php ' );
23+ }
2224$ loader ->addDirectory (__DIR__ . '/files.robots ' );
2325$ loader ->register ();
2426
25- Assert::false ( class_exists ('ConditionalClass ' ) ); // files/conditional.class.php
26- Assert::true ( interface_exists ('TestInterface ' ) ); // file/interface.php
27- if (PHP_VERSION_ID >= 50400 ) Assert::true ( trait_exists ('TestTrait ' ) ); // file/trait.php
28-
29- Assert::true ( class_exists ('TestClass ' ) ); // files/namespaces1.php
30- Assert::true ( class_exists ('MySpace1\TestClass1 ' ) ); // files/namespaces1.php
31- Assert::true ( class_exists ('MySpace2\TestClass2 ' ) ); // files/namespaces2.php
32- Assert::true ( class_exists ('MySpace3\TestClass3 ' ) ); // files/namespaces2.php
33-
34- Assert::false ( class_exists ('Disallowed1 ' ) ); // files.robots\disallowed1\class.php
35- Assert::false ( class_exists ('Disallowed2 ' ) ); // files.robots\disallowed2\class.php
36- Assert::false ( class_exists ('Disallowed3 ' ) ); // files.robots\subdir\class.php
37- Assert::true ( class_exists ('Allowed1 ' ) ); // files.robots\subdir\allowed.php
38- Assert::false ( class_exists ('Disallowed4 ' ) ); // files.robots\subdir\disallowed4\class.php
39- Assert::false ( class_exists ('Disallowed5 ' ) ); // files.robots\subdir\subdir2\disallowed5\class.php
40- Assert::false ( class_exists ('Disallowed6 ' ) ); // files.robots\subdir\subdir2\class.php
41- Assert::true ( class_exists ('Allowed2 ' ) ); // files.robots\subdir\subdir2\allowed.php
27+ Assert::false (class_exists ('ConditionalClass ' )); // files/conditional.class.php
28+ Assert::true (interface_exists ('TestInterface ' )); // file/interface.php
29+ if (PHP_VERSION_ID >= 50400 ) {
30+ Assert::true (trait_exists ('TestTrait ' ));
31+ } // file/trait.php
32+
33+ Assert::true (class_exists ('TestClass ' )); // files/namespaces1.php
34+ Assert::true (class_exists ('MySpace1\TestClass1 ' )); // files/namespaces1.php
35+ Assert::true (class_exists ('MySpace2\TestClass2 ' )); // files/namespaces2.php
36+ Assert::true (class_exists ('MySpace3\TestClass3 ' )); // files/namespaces2.php
37+
38+ Assert::false (class_exists ('Disallowed1 ' )); // files.robots\disallowed1\class.php
39+ Assert::false (class_exists ('Disallowed2 ' )); // files.robots\disallowed2\class.php
40+ Assert::false (class_exists ('Disallowed3 ' )); // files.robots\subdir\class.php
41+ Assert::true (class_exists ('Allowed1 ' )); // files.robots\subdir\allowed.php
42+ Assert::false (class_exists ('Disallowed4 ' )); // files.robots\subdir\disallowed4\class.php
43+ Assert::false (class_exists ('Disallowed5 ' )); // files.robots\subdir\subdir2\disallowed5\class.php
44+ Assert::false (class_exists ('Disallowed6 ' )); // files.robots\subdir\subdir2\class.php
45+ Assert::true (class_exists ('Allowed2 ' )); // files.robots\subdir\subdir2\allowed.php
0 commit comments