From a18e21487d559eb692ecef535b9d131e77a1a9f5 Mon Sep 17 00:00:00 2001 From: Eric Boh Date: Thu, 13 Sep 2012 21:40:42 +0200 Subject: [PATCH] Removed remains of old Zend test folder. --- test/AutoloadDoesNotHideParseError.php | 15 + test/AutoloadableClass.php | 18 ++ test/AutoloaderFactoryTest.php | 198 +++++++++++++ test/AutoloaderMultiVersionTest.php | 206 ++++++++++++++ test/ClassMapAutoloaderTest.php | 185 ++++++++++++ test/ModuleAutoloaderTest.php | 212 ++++++++++++++ test/MyLoader.php | 24 ++ test/MyOverloader.php | 34 +++ test/PluginClassLoaderTest.php | 266 ++++++++++++++++++ test/StandardAutoloaderTest.php | 197 +++++++++++++ test/TestAsset/ClassMappedClass.php | 27 ++ test/TestAsset/CustomClassLoader.php | 23 ++ test/TestAsset/ExtendedPluginClassLoader.php | 28 ++ .../TestAsset/Name_Space/Namespaced/Class.php | 21 ++ test/TestAsset/NamespacedClass.php | 21 ++ test/TestAsset/PrefixedClass.php | 19 ++ test/TestAsset/SamplePlugin.php | 27 ++ test/TestAsset/ServiceLocator.php | 37 +++ test/TestAsset/StandardAutoloader.php | 42 +++ test/TestAsset/TestNamespace/FallbackCase.php | 21 ++ .../NoDuplicateAutoloadersCase.php | 21 ++ test/TestAsset/TestPluginMap.php | 41 +++ test/TestAsset/TestPlugins/Bar.php | 21 ++ test/TestAsset/TestPlugins/Baz.php | 21 ++ test/TestAsset/TestPlugins/Foo.php | 21 ++ test/TestAsset/TestPlugins2/Foo.php | 21 ++ test/TestAsset/UnMappedClass.php | 21 ++ test/TestAsset/plugins/Baz.php | 23 ++ test/TestAsset/plugins/first/Bat.php | 23 ++ test/TestAsset/plugins/first/Foobar.php | 23 ++ test/TestAsset/plugins/second/Bat.php | 21 ++ test/TestAsset/plugins/second/Foobar.php | 23 ++ test/TestAsset/plugins/second/Foobarbaz.php | 19 ++ test/_files/AutoloaderClosure.php | 5 + test/_files/FooModule/Module.php | 15 + test/_files/FooModule/SubModule/Module.php | 15 + test/_files/InvalidInterfaceAutoloader.php | 4 + test/_files/NoModuleClassModule/Module.php | 2 + test/_files/NonmatchingModule/Module.php | 15 + test/_files/ParseError.php | 21 ++ test/_files/PharModule.phar | Bin 0 -> 6821 bytes test/_files/PharModuleBz2.phar.bz2 | Bin 0 -> 2690 bytes test/_files/PharModuleExplicit.phar | Bin 0 -> 6829 bytes test/_files/PharModuleFake.tar/readme | 2 + test/_files/PharModuleFake.zip | Bin 0 -> 175 bytes test/_files/PharModuleGz.phar.gz | Bin 0 -> 2529 bytes test/_files/PharModuleNested.tar.gz | Bin 0 -> 141 bytes test/_files/PharModuleNestedFake.tar.gz | Bin 0 -> 131 bytes test/_files/PharModulePharTar.phar.tar | Bin 0 -> 4096 bytes test/_files/PharModulePharTarBz2.phar.tar.bz2 | Bin 0 -> 318 bytes test/_files/PharModulePharTarGz.phar.tar.gz | Bin 0 -> 291 bytes test/_files/PharModulePharZip.phar.zip | Bin 0 -> 585 bytes test/_files/PharModuleTar.tar | Bin 0 -> 2048 bytes test/_files/PharModuleTarBz2.tar.bz2 | Bin 0 -> 145 bytes test/_files/PharModuleTarGz.tar.gz | Bin 0 -> 137 bytes test/_files/PharModuleZip.zip | Bin 0 -> 203 bytes test/_files/ZendLoaderAutoloader/Foo.php | 18 ++ test/_files/ZfTest/CacheTest.php | 20 ++ test/_files/ZfTest/FormSubmit.php | 20 ++ test/_files/Zfns/Foo.php | 15 + test/_files/_buildPhars.php | 78 +++++ test/_files/badmap.php | 2 + test/_files/classmap.phar | Bin 0 -> 6954 bytes test/_files/goodmap.php | 7 + 64 files changed, 2159 insertions(+) create mode 100644 test/AutoloadDoesNotHideParseError.php create mode 100644 test/AutoloadableClass.php create mode 100644 test/AutoloaderFactoryTest.php create mode 100644 test/AutoloaderMultiVersionTest.php create mode 100644 test/ClassMapAutoloaderTest.php create mode 100644 test/ModuleAutoloaderTest.php create mode 100644 test/MyLoader.php create mode 100644 test/MyOverloader.php create mode 100644 test/PluginClassLoaderTest.php create mode 100644 test/StandardAutoloaderTest.php create mode 100644 test/TestAsset/ClassMappedClass.php create mode 100644 test/TestAsset/CustomClassLoader.php create mode 100644 test/TestAsset/ExtendedPluginClassLoader.php create mode 100644 test/TestAsset/Name_Space/Namespaced/Class.php create mode 100644 test/TestAsset/NamespacedClass.php create mode 100644 test/TestAsset/PrefixedClass.php create mode 100644 test/TestAsset/SamplePlugin.php create mode 100644 test/TestAsset/ServiceLocator.php create mode 100644 test/TestAsset/StandardAutoloader.php create mode 100644 test/TestAsset/TestNamespace/FallbackCase.php create mode 100644 test/TestAsset/TestNamespace/NoDuplicateAutoloadersCase.php create mode 100644 test/TestAsset/TestPluginMap.php create mode 100644 test/TestAsset/TestPlugins/Bar.php create mode 100644 test/TestAsset/TestPlugins/Baz.php create mode 100644 test/TestAsset/TestPlugins/Foo.php create mode 100644 test/TestAsset/TestPlugins2/Foo.php create mode 100644 test/TestAsset/UnMappedClass.php create mode 100644 test/TestAsset/plugins/Baz.php create mode 100644 test/TestAsset/plugins/first/Bat.php create mode 100644 test/TestAsset/plugins/first/Foobar.php create mode 100644 test/TestAsset/plugins/second/Bat.php create mode 100644 test/TestAsset/plugins/second/Foobar.php create mode 100644 test/TestAsset/plugins/second/Foobarbaz.php create mode 100644 test/_files/AutoloaderClosure.php create mode 100644 test/_files/FooModule/Module.php create mode 100644 test/_files/FooModule/SubModule/Module.php create mode 100644 test/_files/InvalidInterfaceAutoloader.php create mode 100644 test/_files/NoModuleClassModule/Module.php create mode 100644 test/_files/NonmatchingModule/Module.php create mode 100644 test/_files/ParseError.php create mode 100644 test/_files/PharModule.phar create mode 100644 test/_files/PharModuleBz2.phar.bz2 create mode 100644 test/_files/PharModuleExplicit.phar create mode 100644 test/_files/PharModuleFake.tar/readme create mode 100644 test/_files/PharModuleFake.zip create mode 100644 test/_files/PharModuleGz.phar.gz create mode 100644 test/_files/PharModuleNested.tar.gz create mode 100644 test/_files/PharModuleNestedFake.tar.gz create mode 100644 test/_files/PharModulePharTar.phar.tar create mode 100644 test/_files/PharModulePharTarBz2.phar.tar.bz2 create mode 100644 test/_files/PharModulePharTarGz.phar.tar.gz create mode 100644 test/_files/PharModulePharZip.phar.zip create mode 100644 test/_files/PharModuleTar.tar create mode 100644 test/_files/PharModuleTarBz2.tar.bz2 create mode 100644 test/_files/PharModuleTarGz.tar.gz create mode 100644 test/_files/PharModuleZip.zip create mode 100644 test/_files/ZendLoaderAutoloader/Foo.php create mode 100644 test/_files/ZfTest/CacheTest.php create mode 100644 test/_files/ZfTest/FormSubmit.php create mode 100644 test/_files/Zfns/Foo.php create mode 100644 test/_files/_buildPhars.php create mode 100644 test/_files/badmap.php create mode 100644 test/_files/classmap.phar create mode 100644 test/_files/goodmap.php diff --git a/test/AutoloadDoesNotHideParseError.php b/test/AutoloadDoesNotHideParseError.php new file mode 100644 index 0000000..912cf2e --- /dev/null +++ b/test/AutoloadDoesNotHideParseError.php @@ -0,0 +1,15 @@ +loaders = spl_autoload_functions(); + if (!is_array($this->loaders)) { + // spl_autoload_functions does not return empty array when no + // autoloaders registered... + $this->loaders = array(); + } + + // Store original include_path + $this->includePath = get_include_path(); + } + + public function tearDown() + { + AutoloaderFactory::unregisterAutoloaders(); + // Restore original autoloaders + $loaders = spl_autoload_functions(); + if (is_array($loaders)) { + foreach ($loaders as $loader) { + spl_autoload_unregister($loader); + } + } + + foreach ($this->loaders as $loader) { + spl_autoload_register($loader); + } + + // Restore original include_path + set_include_path($this->includePath); + } + + public function testRegisteringValidMapFilePopulatesAutoloader() + { + AutoloaderFactory::factory(array( + 'Zend\Loader\ClassMapAutoloader' => array( + __DIR__ . '/_files/goodmap.php', + ), + )); + $loader = AutoloaderFactory::getRegisteredAutoloader('Zend\Loader\ClassMapAutoloader'); + $map = $loader->getAutoloadMap(); + $this->assertTrue(is_array($map)); + $this->assertEquals(2, count($map)); + } + + /** + * This tests checks if invalid autoloaders cause exceptions + * + * @expectedException InvalidArgumentException + */ + public function testFactoryCatchesInvalidClasses() + { + if (!version_compare(PHP_VERSION, '5.3.7', '>=')) { + $this->markTestSkipped('Cannot test invalid interface loader with versions less than 5.3.7'); + } + include __DIR__ . '/_files/InvalidInterfaceAutoloader.php'; + AutoloaderFactory::factory(array( + 'InvalidInterfaceAutoloader' => array() + )); + } + + public function testFactoryDoesNotRegisterDuplicateAutoloaders() + { + AutoloaderFactory::factory(array( + 'Zend\Loader\StandardAutoloader' => array( + 'namespaces' => array( + 'TestNamespace' => __DIR__ . '/TestAsset/TestNamespace', + ), + ), + )); + $this->assertEquals(1, count(AutoloaderFactory::getRegisteredAutoloaders())); + AutoloaderFactory::factory(array( + 'Zend\Loader\StandardAutoloader' => array( + 'namespaces' => array( + 'ZendTest\Loader\TestAsset\TestPlugins' => __DIR__ . '/TestAsset/TestPlugins', + ), + ), + )); + $this->assertEquals(1, count(AutoloaderFactory::getRegisteredAutoloaders())); + $this->assertTrue(class_exists('TestNamespace\NoDuplicateAutoloadersCase')); + $this->assertTrue(class_exists('ZendTest\Loader\TestAsset\TestPlugins\Foo')); + } + + public function testCanUnregisterAutoloaders() + { + AutoloaderFactory::factory(array( + 'Zend\Loader\StandardAutoloader' => array( + 'namespaces' => array( + 'TestNamespace' => __DIR__ . '/TestAsset/TestNamespace', + ), + ), + )); + AutoloaderFactory::unregisterAutoloaders(); + $this->assertEquals(0, count(AutoloaderFactory::getRegisteredAutoloaders())); + } + + public function testCanUnregisterAutoloadersByClassName() + { + AutoloaderFactory::factory(array( + 'Zend\Loader\StandardAutoloader' => array( + 'namespaces' => array( + 'TestNamespace' => __DIR__ . '/TestAsset/TestNamespace', + ), + ), + )); + AutoloaderFactory::unregisterAutoloader('Zend\Loader\StandardAutoloader'); + $this->assertEquals(0, count(AutoloaderFactory::getRegisteredAutoloaders())); + } + + public function testCanGetValidRegisteredAutoloader() + { + AutoloaderFactory::factory(array( + 'Zend\Loader\StandardAutoloader' => array( + 'namespaces' => array( + 'TestNamespace' => __DIR__ . '/TestAsset/TestNamespace', + ), + ), + )); + $autoloader = AutoloaderFactory::getRegisteredAutoloader('Zend\Loader\StandardAutoloader'); + $this->assertInstanceOf('Zend\Loader\StandardAutoloader', $autoloader); + } + + public function testDefaultAutoloader() + { + AutoloaderFactory::factory(); + $autoloader = AutoloaderFactory::getRegisteredAutoloader('Zend\Loader\StandardAutoloader'); + $this->assertInstanceOf('Zend\Loader\StandardAutoloader', $autoloader); + $this->assertEquals(1, count(AutoloaderFactory::getRegisteredAutoloaders())); + } + + public function testGetInvalidAutoloaderThrowsException() + { + $this->setExpectedException('Zend\Loader\Exception\InvalidArgumentException'); + $loader = AutoloaderFactory::getRegisteredAutoloader('InvalidAutoloader'); + } + + public function testFactoryWithInvalidArgumentThrowsException() + { + $this->setExpectedException('Zend\Loader\Exception\InvalidArgumentException'); + AutoloaderFactory::factory('InvalidArgument'); + } + + public function testFactoryWithInvalidAutoloaderClassThrowsException() + { + $this->setExpectedException('Zend\Loader\Exception\InvalidArgumentException'); + AutoloaderFactory::factory(array('InvalidAutoloader' => array())); + } + + public function testCannotBeInstantiatedViaConstructor() + { + $reflection = new ReflectionClass('Zend\Loader\AutoloaderFactory'); + $constructor = $reflection->getConstructor(); + $this->assertNull($constructor); + } + + public function testPassingNoArgumentsToFactoryInstantiatesAndRegistersStandardAutoloader() + { + AutoloaderFactory::factory(); + $loaders = AutoloaderFactory::getRegisteredAutoloaders(); + $this->assertEquals(1, count($loaders)); + $loader = array_shift($loaders); + $this->assertInstanceOf('Zend\Loader\StandardAutoloader', $loader); + + $test = array($loader, 'autoload'); + $found = false; + foreach (spl_autoload_functions() as $function) { + if ($function === $test) { + $found = true; + break; + } + } + $this->assertTrue($found, 'StandardAutoloader not registered with spl_autoload'); + } +} diff --git a/test/AutoloaderMultiVersionTest.php b/test/AutoloaderMultiVersionTest.php new file mode 100644 index 0000000..a2b1945 --- /dev/null +++ b/test/AutoloaderMultiVersionTest.php @@ -0,0 +1,206 @@ +isEnabled()) { + $this->markTestSkipped('Option TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_ENABLED is not enabled'); + } + + // Store original autoloaders + $this->loaders = spl_autoload_functions(); + if (!is_array($this->loaders)) { + // spl_autoload_functions does not return empty array when no + // autoloaders registered... + $this->loaders = array(); + } + // Store original include_path + $this->includePath = get_include_path(); + + Autoloader::resetInstance(); + $this->path = constant('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_PATH'); + $this->latest = constant('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST'); + $this->latestMajor = constant('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST_MAJOR'); + $this->latestMinor = constant('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST_MINOR'); + $this->specific = constant('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_SPECIFIC'); + $this->autoloader = Autoloader::getInstance(); + } + + public function tearDown() + { + if (!$this->isEnabled()) { + return; + } + // Restore original autoloaders + $loaders = spl_autoload_functions(); + foreach ($loaders as $loader) { + spl_autoload_unregister($loader); + } + + foreach ($this->loaders as $loader) { + spl_autoload_register($loader); + } + + // Retore original include_path + set_include_path($this->includePath); + + // Reset autoloader instance so it doesn't affect other tests + Autoloader::resetInstance(); + Autoloader::getInstance(); + } + + public function testZfPathIsNullByDefault() + { + $this->assertNull($this->autoloader->getZfPath()); + } + + /** + * @expectedException Zend\Loader\Exception\ExceptionInterface + */ + public function testSettingZfPathFailsOnInvalidVersionString() + { + $this->autoloader->setZfPath($this->path, 'foo.bar.baz.bat'); + } + + /** + * @expectedException Zend\Loader\Exception\ExceptionInterface + */ + public function testSettingZfPathFailsWhenBasePathDoesNotExist() + { + $this->autoloader->setZfPath('foo.bar.baz.bat', 'latest'); + } + + /** + * @expectedException Zend\Loader\Exception\ExceptionInterface + */ + public function testSettingZfVersionFailsWhenNoValidInstallsDiscovered() + { + $this->autoloader->setZfPath(__DIR__, 'latest'); + } + + public function testAutoloadLatestUsesLatestVersion() + { + $this->autoloader->setZfPath($this->path, 'latest'); + $actual = $this->autoloader->getZfPath(); + $this->assertContains($this->latest, $actual); + } + + public function testAutoloadLatestIncludesLibraryInPath() + { + $this->autoloader->setZfPath($this->path, 'latest'); + $actual = $this->autoloader->getZfPath(); + $this->assertRegexp('#' . preg_quote($this->latest) . '[^/\\\]*/library#', $actual); + } + + public function testAutoloadLatestAddsPathToIncludePath() + { + $this->autoloader->setZfPath($this->path, 'latest'); + $incPath = get_include_path(); + $this->assertRegexp('#' . preg_quote($this->latest) . '[^/\\\]*/library#', $incPath); + } + + public function testAutoloadMajorRevisionShouldUseLatestFromMajorRevision() + { + $this->autoloader->setZfPath($this->path, $this->_getVersion($this->latestMajor, 'major')); + $actual = $this->autoloader->getZfPath(); + $this->assertContains($this->latestMajor, $actual); + } + + public function testAutoloadMajorRevisionIncludesLibraryInPath() + { + $this->autoloader->setZfPath($this->path, $this->_getVersion($this->latestMajor, 'major')); + $actual = $this->autoloader->getZfPath(); + $this->assertRegexp('#' . preg_quote($this->latestMajor) . '[^/\\\]*/library#', $actual); + } + + public function testAutoloadMajorRevisionAddsPathToIncludePath() + { + $this->autoloader->setZfPath($this->path, $this->_getVersion($this->latestMajor, 'major')); + $incPath = get_include_path(); + $this->assertRegexp('#' . preg_quote($this->latestMajor) . '[^/\\\]*/library#', $incPath); + } + + public function testAutoloadMinorRevisionShouldUseLatestFromMinorRevision() + { + $this->autoloader->setZfPath($this->path, $this->_getVersion($this->latestMinor, 'minor')); + $actual = $this->autoloader->getZfPath(); + $this->assertContains($this->latestMinor, $actual); + } + + public function testAutoloadMinorRevisionIncludesLibraryInPath() + { + $this->autoloader->setZfPath($this->path, $this->_getVersion($this->latestMinor, 'minor')); + $actual = $this->autoloader->getZfPath(); + $this->assertRegexp('#' . preg_quote($this->latestMinor) . '[^/\\\]*/library#', $actual); + } + + public function testAutoloadMinorRevisionAddsPathToIncludePath() + { + $this->autoloader->setZfPath($this->path, $this->_getVersion($this->latestMinor, 'minor')); + $incPath = get_include_path(); + $this->assertRegexp('#' . preg_quote($this->latestMinor) . '[^/\\\]*/library#', $incPath); + } + + public function testAutoloadSpecificRevisionShouldUseThatVersion() + { + $this->autoloader->setZfPath($this->path, $this->specific); + $actual = $this->autoloader->getZfPath(); + $this->assertContains($this->specific, $actual); + } + + public function testAutoloadSpecificRevisionIncludesLibraryInPath() + { + $this->autoloader->setZfPath($this->path, $this->specific); + $actual = $this->autoloader->getZfPath(); + $this->assertRegexp('#' . preg_quote($this->specific) . '[^/\\\]*/library#', $actual); + } + + public function testAutoloadSpecificRevisionAddsPathToIncludePath() + { + $this->autoloader->setZfPath($this->path, $this->specific); + $incPath = get_include_path(); + $this->assertRegexp('#' . preg_quote($this->specific) . '[^/\\\]*/library#', $incPath); + } + + protected function _getVersion($version, $type) + { + $parts = explode('.', $version); + switch ($type) { + case 'major': + $value = array_shift($parts); + break; + case 'minor': + $value = array_shift($parts); + $value .= '.' . array_shift($parts); + break; + } + return $value; + } +} diff --git a/test/ClassMapAutoloaderTest.php b/test/ClassMapAutoloaderTest.php new file mode 100644 index 0000000..4872032 --- /dev/null +++ b/test/ClassMapAutoloaderTest.php @@ -0,0 +1,185 @@ +loaders = spl_autoload_functions(); + if (!is_array($this->loaders)) { + // spl_autoload_functions does not return empty array when no + // autoloaders registered... + $this->loaders = array(); + } + + // Store original include_path + $this->includePath = get_include_path(); + + $this->loader = new ClassMapAutoloader(); + } + + public function tearDown() + { + // Restore original autoloaders + $loaders = spl_autoload_functions(); + if (is_array($loaders)) { + foreach ($loaders as $loader) { + spl_autoload_unregister($loader); + } + } + + foreach ($this->loaders as $loader) { + spl_autoload_register($loader); + } + + // Restore original include_path + set_include_path($this->includePath); + } + + public function testRegisteringNonExistentAutoloadMapRaisesInvalidArgumentException() + { + $dir = __DIR__ . '__foobar__'; + $this->setExpectedException('Zend\Loader\Exception\InvalidArgumentException'); + $this->loader->registerAutoloadMap($dir); + } + + public function testValidMapFileNotReturningMapRaisesInvalidArgumentException() + { + $this->setExpectedException('Zend\Loader\Exception\InvalidArgumentException'); + $this->loader->registerAutoloadMap(__DIR__ . '/_files/badmap.php'); + } + + public function testAllowsRegisteringArrayAutoloadMapDirectly() + { + $map = array( + 'Zend\Loader\Exception\ExceptionInterface' => __DIR__ . '/../../../library/Zend/Loader/Exception/ExceptionInterface.php', + ); + $this->loader->registerAutoloadMap($map); + $test = $this->loader->getAutoloadMap(); + $this->assertSame($map, $test); + } + + public function testAllowsRegisteringArrayAutoloadMapViaConstructor() + { + $map = array( + 'Zend\Loader\Exception\ExceptionInterface' => __DIR__ . '/../../../library/Zend/Loader/Exception/ExceptionInterface.php', + ); + $loader = new ClassMapAutoloader(array($map)); + $test = $loader->getAutoloadMap(); + $this->assertSame($map, $test); + } + + public function testRegisteringValidMapFilePopulatesAutoloader() + { + $this->loader->registerAutoloadMap(__DIR__ . '/_files/goodmap.php'); + $map = $this->loader->getAutoloadMap(); + $this->assertTrue(is_array($map)); + $this->assertEquals(2, count($map)); + // Just to make sure nothing changes after loading the same map again + // (loadMapFromFile should just return) + $this->loader->registerAutoloadMap(__DIR__ . '/_files/goodmap.php'); + $map = $this->loader->getAutoloadMap(); + $this->assertTrue(is_array($map)); + $this->assertEquals(2, count($map)); + } + + public function testRegisteringMultipleMapsMergesThem() + { + $map = array( + 'Zend\Loader\Exception\ExceptionInterface' => __DIR__ . '/../../../library/Zend/Loader/Exception/ExceptionInterface.php', + 'ZendTest\Loader\StandardAutoloaderTest' => 'some/bogus/path.php', + ); + $this->loader->registerAutoloadMap($map); + $this->loader->registerAutoloadMap(__DIR__ . '/_files/goodmap.php'); + + $test = $this->loader->getAutoloadMap(); + $this->assertTrue(is_array($test)); + $this->assertEquals(3, count($test)); + $this->assertNotEquals($map['ZendTest\Loader\StandardAutoloaderTest'], $test['ZendTest\Loader\StandardAutoloaderTest']); + } + + public function testCanRegisterMultipleMapsAtOnce() + { + $map = array( + 'Zend\Loader\Exception\ExceptionInterface' => __DIR__ . '/../../../library/Zend/Loader/Exception/ExceptionInterface.php', + 'ZendTest\Loader\StandardAutoloaderTest' => 'some/bogus/path.php', + ); + $maps = array($map, __DIR__ . '/_files/goodmap.php'); + $this->loader->registerAutoloadMaps($maps); + $test = $this->loader->getAutoloadMap(); + $this->assertTrue(is_array($test)); + $this->assertEquals(3, count($test)); + } + + public function testRegisterMapsThrowsExceptionForNonTraversableArguments() + { + $tests = array(true, 'string', 1, 1.0, new \stdClass); + foreach ($tests as $test) { + try { + $this->loader->registerAutoloadMaps($test); + $this->fail('Should not register non-traversable arguments'); + } catch (InvalidArgumentException $e) { + $this->assertContains('array or implement Traversable', $e->getMessage()); + } + } + } + + public function testAutoloadLoadsClasses() + { + $map = array('ZendTest\UnusualNamespace\ClassMappedClass' => __DIR__ . '/TestAsset/ClassMappedClass.php'); + $this->loader->registerAutoloadMap($map); + $this->loader->autoload('ZendTest\UnusualNamespace\ClassMappedClass'); + $this->assertTrue(class_exists('ZendTest\UnusualNamespace\ClassMappedClass', false)); + } + + public function testIgnoresClassesNotInItsMap() + { + $map = array('ZendTest\UnusualNamespace\ClassMappedClass' => __DIR__ . '/TestAsset/ClassMappedClass.php'); + $this->loader->registerAutoloadMap($map); + $this->loader->autoload('ZendTest\UnusualNamespace\UnMappedClass'); + $this->assertFalse(class_exists('ZendTest\UnusualNamespace\UnMappedClass', false)); + } + + public function testRegisterRegistersCallbackWithSplAutoload() + { + $this->loader->register(); + $loaders = spl_autoload_functions(); + $this->assertTrue(count($this->loaders) < count($loaders)); + $test = array_shift($loaders); + $this->assertEquals(array($this->loader, 'autoload'), $test); + } + + public function testCanLoadClassMapFromPhar() + { + $map = 'phar://' . __DIR__ . '/_files/classmap.phar/test/.//../autoload_classmap.php'; + $this->loader->registerAutoloadMap($map); + $this->loader->autoload('some\loadedclass'); + $this->assertTrue(class_exists('some\loadedclass', false)); + + // will not register duplicate, even with a different relative path + $map = 'phar://' . __DIR__ . '/_files/classmap.phar/test/./foo/../../autoload_classmap.php'; + $this->loader->registerAutoloadMap($map); + $test = $this->loader->getAutoloadMap(); + $this->assertEquals(1, count($test)); + } + +} diff --git a/test/ModuleAutoloaderTest.php b/test/ModuleAutoloaderTest.php new file mode 100644 index 0000000..c6e6e79 --- /dev/null +++ b/test/ModuleAutoloaderTest.php @@ -0,0 +1,212 @@ +loaders = spl_autoload_functions(); + if (!is_array($this->loaders)) { + // spl_autoload_functions does not return empty array when no + // autoloaders registered... + $this->loaders = array(); + } + + // Store original include_path + $this->includePath = get_include_path(); + } + + public function tearDown() + { + // Restore original autoloaders + $loaders = spl_autoload_functions(); + if (is_array($loaders)) { + foreach ($loaders as $loader) { + spl_autoload_unregister($loader); + } + } + + foreach ($this->loaders as $loader) { + spl_autoload_register($loader); + } + + // Restore original include_path + set_include_path($this->includePath); + } + + public function testCanRegisterPathsFromConstructor() + { + $paths = array(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR); + $loader = new ModuleAutoloader($paths); + $registeredPaths = $loader->getPaths(); + $this->assertSame($paths, $registeredPaths); + } + + public function testPathsNormalizedWithTrailingSlash() + { + $paths = array( + __DIR__ . DIRECTORY_SEPARATOR . '_files', + __DIR__ . DIRECTORY_SEPARATOR . '_files///', + __DIR__ . DIRECTORY_SEPARATOR . '_files\\\\', + ); + $loader = new ModuleAutoloader($paths); + $registeredPaths = $loader->getPaths(); + $this->assertSame(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR, $registeredPaths[0]); + $this->assertSame(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR, $registeredPaths[1]); + $this->assertSame(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR, $registeredPaths[2]); + } + + public function testCanAutoloadModule() + { + $loader = new ModuleAutoloader; + $loader->registerPath(__DIR__ . '/_files/'); + $moduleClass = $loader->autoload('FooModule\Module'); + $this->assertSame('FooModule\Module', $moduleClass); + $module = new \FooModule\Module; + $this->assertInstanceOf('FooModule\Module', $module); + } + + public function testCanAutoloadSubModule() + { + $loader = new ModuleAutoloader; + $loader->registerPath(__DIR__ . '/_files/'); + $loader->register(); + $subModule = new \FooModule\SubModule\Module; + $this->assertInstanceOf('FooModule\SubModule\Module', $subModule); + $loader->unregister(); + } + + public function testCanAutoloadPharModules() + { + $loader = new ModuleAutoloader; + $loader->registerPath(__DIR__ . '/_files/'); + $loader->register(); + + $this->assertTrue(class_exists('PharModule\Module')); + $this->assertTrue(class_exists('PharModuleTar\Module')); + $this->assertTrue(class_exists('PharModulePharTar\Module')); + $this->assertTrue(class_exists('PharModuleNested\Module')); + + // gzip / zip + if (extension_loaded('zlib')) { + // gzip + $this->assertTrue(class_exists('PharModuleGz\Module')); + $this->assertTrue(class_exists('PharModulePharTarGz\Module')); + $this->assertTrue(class_exists('PharModuleTarGz\Module')); + + // zip + $this->assertTrue(class_exists('PharModulePharZip\Module')); + $this->assertTrue(class_exists('PharModuleZip\Module')); + } else { + $this->assertFalse(class_exists('PharModuleGz\Module')); + $this->assertFalse(class_exists('PharModulePharTarGz\Module')); + $this->assertFalse(class_exists('PharModuleTarGz\Module')); + + $this->assertFalse(class_exists('PharModulePharZip\Module')); + $this->assertFalse(class_exists('PharModuleZip\Module')); + } + + // bzip2 + if (extension_loaded('bzip2')) { + $this->assertTrue(class_exists('PharModuleBz2\Module')); + $this->assertTrue(class_exists('PharModulePharTarBz2\Module')); + $this->assertTrue(class_exists('PharModuleTarBz2\Module')); + } else { + $this->assertFalse(class_exists('PharModuleBz2\Module')); + $this->assertFalse(class_exists('PharModulePharTarBz2\Module')); + $this->assertFalse(class_exists('PharModuleTarBz2\Module')); + } + + $loader->unregister(); + } + + public function testProvidesFluidInterface() + { + $loader = new ModuleAutoloader; + $this->assertInstanceOf('Zend\Loader\ModuleAutoloader', $loader->setOptions(array('foo'))); + $this->assertInstanceOf('Zend\Loader\ModuleAutoloader', $loader->registerPaths(array('foo'))); + $this->assertInstanceOf('Zend\Loader\ModuleAutoloader', $loader->registerPath('foo')); + } + + public function testReturnsFalseForNonModuleClass() + { + $loader = new ModuleAutoloader; + $loader->registerPath(__DIR__ . '/_files/'); + $moduleClass = $loader->autoload('FooModule\NotModule'); + $this->assertFalse($moduleClass); + } + + public function testReturnsFalseForNonExistantModuleClass() + { + $loader = new ModuleAutoloader; + $loader->registerPath(__DIR__ . '/_files/'); + $moduleClass = $loader->autoload('NonExistantModule\Module'); + $this->assertFalse($moduleClass); + $loader->registerPath(__DIR__ . '/_files/NonExistantModule', 'NonExistantModule'); + $moduleClass = $loader->autoload('NonExistantModule\Module'); + $this->assertFalse($moduleClass); + $moduleClass = $loader->autoload('NoModuleClassModule\Module'); + $this->assertFalse($moduleClass); + } + + public function testReturnsFalseForNonModulePhar() + { + $loader = new ModuleAutoloader; + $loader->registerPath(__DIR__ . '/_files/'); + $moduleClass = $loader->autoload('PharModuleFake\Module'); + $moduleClass = $loader->autoload('PharModuleNestedFake\Module'); + $this->assertFalse($moduleClass); + } + + public function testInvalidPathThrowsException() + { + $loader = new ModuleAutoloader; + $this->setExpectedException('InvalidArgumentException'); + $loader->registerPath(123); + } + + public function testInvalidPathsThrowsException() + { + $loader = new ModuleAutoloader; + $this->setExpectedException('InvalidArgumentException'); + $loader->registerPaths(123); + } + + public function testCanLoadModulesFromExplicitLocation() + { + $loader = new ModuleAutoloader(array( + 'My\NonmatchingModule' => __DIR__ . '/_files/NonmatchingModule', + 'PharModuleExplicit' => __DIR__ . '/_files/PharModuleExplicit.phar', + )); + $loader->register(); + $this->assertTrue(class_exists('My\NonmatchingModule\Module')); + $this->assertTrue(class_exists('PharModuleExplicit\Module')); + } + + public function testCanLoadModulesFromClassMap() + { + $loader = new ModuleAutoloader(); + $loader->setModuleClassMap(array( + 'BarModule\Module' => __DIR__ . '/_files/BarModule/Module.php', + 'PharModuleMap\Module' => __DIR__ . '/_files/PharModuleMap.phar', + )); + $loader->register(); + + $this->assertTrue(class_exists('BarModule\Module')); + $this->assertTrue(class_exists('PharModuleMap\Module')); + } +} diff --git a/test/MyLoader.php b/test/MyLoader.php new file mode 100644 index 0000000..da91bae --- /dev/null +++ b/test/MyLoader.php @@ -0,0 +1,24 @@ +loader = new PluginClassLoader(); + } + + public function testPluginClassLoaderHasNoAssociationsByDefault() + { + $plugins = $this->loader->getRegisteredPlugins(); + $this->assertTrue(empty($plugins)); + } + + public function testRegisterPluginRegistersShortNameClassNameAssociation() + { + $this->loader->registerPlugin('loader', __CLASS__); + $plugins = $this->loader->getRegisteredPlugins(); + $this->assertArrayHasKey('loader', $plugins); + $this->assertEquals(__CLASS__, $plugins['loader']); + } + + public function testCallingRegisterPluginWithAnExistingPluginNameOverwritesThatMapAssociation() + { + $this->testRegisterPluginRegistersShortNameClassNameAssociation(); + $this->loader->registerPlugin('loader', 'Zend\Loader\PluginClassLoader'); + $plugins = $this->loader->getRegisteredPlugins(); + $this->assertArrayHasKey('loader', $plugins); + $this->assertEquals('Zend\Loader\PluginClassLoader', $plugins['loader']); + } + + public function testCallingRegisterPluginsWithInvalidStringMapRaisesException() + { + $this->setExpectedException('Zend\Loader\Exception\InvalidArgumentException'); + $this->loader->registerPlugins('__foobar__'); + } + + public function testCallingRegisterPluginsWithStringMapResolvingToNonTraversableClassRaisesException() + { + $this->setExpectedException('Zend\Loader\Exception\InvalidArgumentException'); + $this->loader->registerPlugins('stdClass'); + } + + public function testCallingRegisterPluginsWithValidStringMapResolvingToTraversableClassRegistersPlugins() + { + $this->loader->registerPlugins('ZendTest\Loader\TestAsset\TestPluginMap'); + $pluginMap = new TestAsset\TestPluginMap; + $this->assertEquals($pluginMap->map, $this->loader->getRegisteredPlugins()); + } + + /** + * @dataProvider invalidMaps + */ + public function testCallingRegisterPluginsWithNonArrayNonStringNonTraversableValueRaisesException($arg) + { + $this->setExpectedException('Zend\Loader\Exception\InvalidArgumentException'); + $this->loader->registerPlugins($arg); + } + + public function invalidMaps() + { + return array( + array(null), + array(true), + array(1), + array(1.0), + array(new \stdClass), + ); + } + + public function testCallingRegisterPluginsWithArrayRegistersMap() + { + $map = array('test' => __CLASS__); + $this->loader->registerPlugins($map); + $test = $this->loader->getRegisteredPlugins(); + $this->assertEquals($map, $test); + } + + public function testCallingRegisterPluginsWithTraversableObjectRegistersMap() + { + $map = new TestAsset\TestPluginMap(); + $this->loader->registerPlugins($map); + $test = $this->loader->getRegisteredPlugins(); + $this->assertEquals($map->map, $test); + } + + public function testUnregisterPluginRemovesPluginFromMap() + { + $map = new TestAsset\TestPluginMap(); + $this->loader->registerPlugins($map); + + $this->loader->unregisterPlugin('test'); + + $test = $this->loader->getRegisteredPlugins(); + $this->assertFalse(array_key_exists('test', $test)); + } + + public function testIsLoadedReturnsFalseIfPluginIsNotInMap() + { + $this->assertFalse($this->loader->isLoaded('test')); + } + + public function testIsLoadedReturnsTrueIfPluginIsInMap() + { + $this->loader->registerPlugin('test', __CLASS__); + $this->assertTrue($this->loader->isLoaded('test')); + } + + public function testGetClassNameReturnsFalseIfPluginIsNotInMap() + { + $this->assertFalse($this->loader->getClassName('test')); + } + + public function testGetClassNameReturnsClassNameIfPluginIsInMap() + { + $this->loader->registerPlugin('test', __CLASS__); + $this->assertEquals(__CLASS__, $this->loader->getClassName('test')); + } + + public function testLoadReturnsFalseIfPluginIsNotInMap() + { + $this->assertFalse($this->loader->load('test')); + } + + public function testLoadReturnsClassNameIfPluginIsInMap() + { + $this->loader->registerPlugin('test', __CLASS__); + $this->assertEquals(__CLASS__, $this->loader->load('test')); + } + + public function testIteratingLoaderIteratesPluginMap() + { + $map = new TestAsset\TestPluginMap(); + $this->loader->registerPlugins($map); + $test = array(); + foreach ($this->loader as $name => $class) { + $test[$name] = $class; + } + + $this->assertEquals($map->map, $test); + } + + public function testPluginRegistrationIsCaseInsensitive() + { + $map = array( + 'foo' => __CLASS__, + 'FOO' => __NAMESPACE__ . '\TestAsset\TestPluginMap', + ); + $this->loader->registerPlugins($map); + $this->assertEquals($map['FOO'], $this->loader->getClassName('foo')); + } + + public function testAddingStaticMapDoesNotAffectExistingInstances() + { + PluginClassLoader::addStaticMap(array( + 'test' => __CLASS__, + )); + $this->assertFalse($this->loader->getClassName('test')); + } + + public function testAllowsSettingStaticMapForSeedingInstance() + { + PluginClassLoader::addStaticMap(array( + 'test' => __CLASS__, + )); + $loader = new PluginClassLoader(); + $this->assertEquals(__CLASS__, $loader->getClassName('test')); + } + + public function testPassingNullToStaticMapClearsMap() + { + $this->testAllowsSettingStaticMapForSeedingInstance(); + PluginClassLoader::addStaticMap(null); + $loader = new PluginClassLoader(); + $this->assertFalse($loader->getClassName('test')); + } + + public function testAllowsPassingTraversableObjectToStaticMap() + { + $map = new \ArrayObject(array( + 'test' => __CLASS__, + )); + PluginClassLoader::addStaticMap($map); + $loader = new PluginClassLoader(); + $this->assertEquals(__CLASS__, $loader->getClassName('test')); + } + + public function testMultipleCallsToAddStaticMapMergeMap() + { + PluginClassLoader::addStaticMap(array( + 'test' => __CLASS__, + )); + PluginClassLoader::addStaticMap(array( + 'loader' => 'Zend\Loader\PluginClassLoader', + )); + $loader = new PluginClassLoader(); + $this->assertEquals(__CLASS__, $loader->getClassName('test')); + $this->assertEquals('Zend\Loader\PluginClassLoader', $loader->getClassName('loader')); + } + + public function testStaticMapUsesLateStaticBinding() + { + TestAsset\ExtendedPluginClassLoader::addStaticMap(array('test' => __CLASS__)); + $loader = new PluginClassLoader(); + $this->assertFalse($loader->getClassName('test')); + $loader = new TestAsset\ExtendedPluginClassLoader(); + $this->assertEquals(__CLASS__, $loader->getClassName('test')); + } + + public function testMapPrecedenceIsExplicitTrumpsConstructorTrumpsStaticTrumpsInternal() + { + $loader = new TestAsset\ExtendedPluginClassLoader(); + $this->assertEquals('Zend\Loader\PluginClassLoader', $loader->getClassName('loader')); + + TestAsset\ExtendedPluginClassLoader::addStaticMap(array('loader' => __CLASS__)); + $loader = new TestAsset\ExtendedPluginClassLoader(); + $this->assertEquals(__CLASS__, $loader->getClassName('loader')); + + $loader = new TestAsset\ExtendedPluginClassLoader(array('loader' => 'ZendTest\Loader\TestAsset\ExtendedPluginClassLoader')); + $this->assertEquals('ZendTest\Loader\TestAsset\ExtendedPluginClassLoader', $loader->getClassName('loader')); + + $loader->registerPlugin('loader', __CLASS__); + $this->assertEquals(__CLASS__, $loader->getClassName('loader')); + } + + public function testRegisterPluginsCanAcceptArrayElementWithClassNameProvidingAMap() + { + $pluginMap = new TestAsset\TestPluginMap; + $this->loader->registerPlugins(array('ZendTest\Loader\TestAsset\TestPluginMap')); + $this->assertEquals($pluginMap->map, $this->loader->getRegisteredPlugins()); + } + + public function testRegisterPluginsCanAcceptArrayElementWithObjectProvidingAMap() + { + $pluginMap = new TestAsset\TestPluginMap; + $this->loader->registerPlugins(array($pluginMap)); + $this->assertEquals($pluginMap->map, $this->loader->getRegisteredPlugins()); + } +} diff --git a/test/StandardAutoloaderTest.php b/test/StandardAutoloaderTest.php new file mode 100644 index 0000000..ce4c802 --- /dev/null +++ b/test/StandardAutoloaderTest.php @@ -0,0 +1,197 @@ +loaders = spl_autoload_functions(); + if (!is_array($this->loaders)) { + // spl_autoload_functions does not return empty array when no + // autoloaders registered... + $this->loaders = array(); + } + + // Store original include_path + $this->includePath = get_include_path(); + } + + public function tearDown() + { + // Restore original autoloaders + $loaders = spl_autoload_functions(); + if (is_array($loaders)) { + foreach ($loaders as $loader) { + spl_autoload_unregister($loader); + } + } + + foreach ($this->loaders as $loader) { + spl_autoload_register($loader); + } + + // Restore original include_path + set_include_path($this->includePath); + } + + public function testFallbackAutoloaderFlagDefaultsToFalse() + { + $loader = new StandardAutoloader(); + $this->assertFalse($loader->isFallbackAutoloader()); + } + + public function testFallbackAutoloaderStateIsMutable() + { + $loader = new StandardAutoloader(); + $loader->setFallbackAutoloader(true); + $this->assertTrue($loader->isFallbackAutoloader()); + $loader->setFallbackAutoloader(false); + $this->assertFalse($loader->isFallbackAutoloader()); + } + + public function testPassingNonTraversableOptionsToSetOptionsRaisesException() + { + $loader = new StandardAutoloader(); + + $obj = new \stdClass(); + foreach (array(true, 'foo', $obj) as $arg) { + try { + $loader->setOptions(true); + $this->fail('Setting options with invalid type should fail'); + } catch (InvalidArgumentException $e) { + $this->assertContains('array or Traversable', $e->getMessage()); + } + } + } + + public function testPassingArrayOptionsPopulatesProperties() + { + $options = array( + 'namespaces' => array( + 'Zend\\' => dirname(__DIR__) . DIRECTORY_SEPARATOR, + ), + 'prefixes' => array( + 'Zend_' => dirname(__DIR__) . DIRECTORY_SEPARATOR, + ), + 'fallback_autoloader' => true, + ); + $loader = new TestAsset\StandardAutoloader(); + $loader->setOptions($options); + $this->assertEquals($options['namespaces'], $loader->getNamespaces()); + $this->assertEquals($options['prefixes'], $loader->getPrefixes()); + $this->assertTrue($loader->isFallbackAutoloader()); + } + + public function testPassingTraversableOptionsPopulatesProperties() + { + $namespaces = new \ArrayObject(array( + 'Zend\\' => dirname(__DIR__) . DIRECTORY_SEPARATOR, + )); + $prefixes = new \ArrayObject(array( + 'Zend_' => dirname(__DIR__) . DIRECTORY_SEPARATOR, + )); + $options = new \ArrayObject(array( + 'namespaces' => $namespaces, + 'prefixes' => $prefixes, + 'fallback_autoloader' => true, + )); + $loader = new TestAsset\StandardAutoloader(); + $loader->setOptions($options); + $this->assertEquals((array) $options['namespaces'], $loader->getNamespaces()); + $this->assertEquals((array) $options['prefixes'], $loader->getPrefixes()); + $this->assertTrue($loader->isFallbackAutoloader()); + } + + public function testAutoloadsNamespacedClasses() + { + $loader = new StandardAutoloader(); + $loader->registerNamespace('ZendTest\UnusualNamespace', __DIR__ . '/TestAsset'); + $loader->autoload('ZendTest\UnusualNamespace\NamespacedClass'); + $this->assertTrue(class_exists('ZendTest\UnusualNamespace\NamespacedClass', false)); + } + + public function testAutoloadsVendorPrefixedClasses() + { + $loader = new StandardAutoloader(); + $loader->registerPrefix('ZendTest_UnusualPrefix', __DIR__ . '/TestAsset'); + $loader->autoload('ZendTest_UnusualPrefix_PrefixedClass'); + $this->assertTrue(class_exists('ZendTest_UnusualPrefix_PrefixedClass', false)); + } + + public function testCanActAsFallbackAutoloader() + { + $loader = new StandardAutoloader(); + $loader->setFallbackAutoloader(true); + set_include_path(__DIR__ . '/TestAsset/' . PATH_SEPARATOR . $this->includePath); + $loader->autoload('TestNamespace\FallbackCase'); + $this->assertTrue(class_exists('TestNamespace\FallbackCase', false)); + } + + public function testReturnsFalseForUnresolveableClassNames() + { + $loader = new StandardAutoloader(); + $this->assertFalse($loader->autoload('Some\Fake\Classname')); + } + + public function testReturnsFalseForInvalidClassNames() + { + $loader = new StandardAutoloader(); + $loader->setFallbackAutoloader(true); + $this->assertFalse($loader->autoload('Some\Invalid\Classname\\')); + } + + public function testRegisterRegistersCallbackWithSplAutoload() + { + $loader = new StandardAutoloader(); + $loader->register(); + $loaders = spl_autoload_functions(); + $this->assertTrue(count($this->loaders) < count($loaders)); + $test = array_pop($loaders); + $this->assertEquals(array($loader, 'autoload'), $test); + } + + public function testAutoloadsNamespacedClassesWithUnderscores() + { + $loader = new StandardAutoloader(); + $loader->registerNamespace('ZendTest\UnusualNamespace', __DIR__ . '/TestAsset'); + $loader->autoload('ZendTest\UnusualNamespace\Name_Space\Namespaced_Class'); + $this->assertTrue(class_exists('ZendTest\UnusualNamespace\Name_Space\Namespaced_Class', false)); + } + + public function testZendFrameworkNamespaceIsNotLoadedByDefault() + { + $loader = new StandardAutoloader(); + $expected = array(); + $this->assertAttributeEquals($expected, 'namespaces', $loader); + } + + public function testCanTellAutoloaderToRegisterZendNamespaceAtInstantiation() + { + $loader = new StandardAutoloader(array('autoregister_zf' => true)); + $r = new ReflectionClass($loader); + $file = $r->getFileName(); + $expected = array('Zend\\' => dirname(dirname($file)) . DIRECTORY_SEPARATOR); + $this->assertAttributeEquals($expected, 'namespaces', $loader); + } + +} diff --git a/test/TestAsset/ClassMappedClass.php b/test/TestAsset/ClassMappedClass.php new file mode 100644 index 0000000..6af06e2 --- /dev/null +++ b/test/TestAsset/ClassMappedClass.php @@ -0,0 +1,27 @@ +options = $options; + } +} diff --git a/test/TestAsset/CustomClassLoader.php b/test/TestAsset/CustomClassLoader.php new file mode 100644 index 0000000..af9ef87 --- /dev/null +++ b/test/TestAsset/CustomClassLoader.php @@ -0,0 +1,23 @@ + 'Zend\Loader\PluginClassLoader', + ); + + protected static $staticMap = array(); +} diff --git a/test/TestAsset/Name_Space/Namespaced/Class.php b/test/TestAsset/Name_Space/Namespaced/Class.php new file mode 100644 index 0000000..b49e267 --- /dev/null +++ b/test/TestAsset/Name_Space/Namespaced/Class.php @@ -0,0 +1,21 @@ +options = $options; + } +} diff --git a/test/TestAsset/ServiceLocator.php b/test/TestAsset/ServiceLocator.php new file mode 100644 index 0000000..aed4927 --- /dev/null +++ b/test/TestAsset/ServiceLocator.php @@ -0,0 +1,37 @@ +services[$name])) { + return null; + } + + return $this->services[$name]; + } + + public function has($name) + { + return (isset($this->services[$name])); + } + + public function set($name, $object) + { + $this->services[$name] = $object; + } +} diff --git a/test/TestAsset/StandardAutoloader.php b/test/TestAsset/StandardAutoloader.php new file mode 100644 index 0000000..c006a51 --- /dev/null +++ b/test/TestAsset/StandardAutoloader.php @@ -0,0 +1,42 @@ +namespaces; + } + + /** + * Get registered prefixes + * + * @return array + */ + public function getPrefixes() + { + return $this->prefixes; + } +} diff --git a/test/TestAsset/TestNamespace/FallbackCase.php b/test/TestAsset/TestNamespace/FallbackCase.php new file mode 100644 index 0000000..0e846e4 --- /dev/null +++ b/test/TestAsset/TestNamespace/FallbackCase.php @@ -0,0 +1,21 @@ + __CLASS__, + 'test' => 'ZendTest\Loader\PluginClassLoaderTest', + 'loader' => 'Zend\Loader\PluginClassLoader', + ); + + /** + * Return iterator + * + * @return Traversable + */ + public function getIterator() + { + return new \ArrayIterator($this->map); + } +} diff --git a/test/TestAsset/TestPlugins/Bar.php b/test/TestAsset/TestPlugins/Bar.php new file mode 100644 index 0000000..4450ce4 --- /dev/null +++ b/test/TestAsset/TestPlugins/Bar.php @@ -0,0 +1,21 @@ +#HCUFX+zH1so{z6mCrNmk+4VZRf1kO5lVxLm z?PqyrTYbsCi)SAUT6DX9l=IZ(N&eCg_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N6GEi9I{`sqy6Ay?Z~x|DUT*eBjT(|K%@5J6Qeq&wqMLpMUxI zuRs2S1n{>{KP@rCAmEhYj?5YTrXuBVOyyexximg}`ui`BKTWoh|NQOWKl|q|^1mK@ Q^nddF$I$ZX`N{MD0c7wRlmGw# literal 0 HcmV?d00001 diff --git a/test/_files/PharModuleBz2.phar.bz2 b/test/_files/PharModuleBz2.phar.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..30fc22c4d42d879aa307bdffbc39490fcd7d7492 GIT binary patch literal 2690 zcmV-|3VroLT4*#eL0KkKSx%NTLI4Es|L^w@AOLs&|NsB*|GvNf|Na3903ZPb0VD$e z1YklCU<p82|tP0079y z00SUNq@S{WO|004GlEV8foebfYFcun)w)Jn?3QM2lk)3b{@F)Hu>MI`cSYK zio8k{XXu=phX&{?7P*AAEFIb!wQ9Ahjd8&7)tY z7Lrh{RDz8|ZF>t3-L;V{Pf4fN;MHjfd=beH;)OV2G1b@PucY}5hR`)7uzN!eV=^|P zsTq`F45CmsZYZqcM6)y(?^+c<)#SS8KLmAbWbih*}38uidmP~ZRQo_R6kWD(nQqN}|pT}6rCclS6K6y$^G?LDELr~|5 zO&j33>bQ}p&{=WceMy_kZ?}|GcZIK9q|MBZ{I%qHaj9ZxcVm-<6%mgL?ATnt+KCWkD)fD@L-~ z7E(oYo2%0m0Z+kSd!C~6fzB$x@gz1g` zmhg4{SKsfE--}<+-@b z(o79Na}93HV8N^~f{ZW(Dj8cUGDa~De)bUD;cDDQ{tXn|O#TEl?345&y{AQ~_QyeMHUFLenG2fr@=jnalf!m=*vn<6iK zaEoqvp&OQzt8jLjxliROQ6T6TT*k?il3n9f^d8C1{ympwe`e@{6NMppGEpLAq@Z(& zIsHsb?dbNmr{yS=lRb8iFAJ$Y)@>f=_>suHNu}!Fm*JD7M1M=5i53HZ#~D)@Z{9$dTN~x zg?iLFrinr(m3oeX8Y>~Nl2VpJ766L$cCPEl=2#sG$}?;R2m&H*>zn6zE<(G{$R_7* zin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(HP%_$nx%)bkWxcZ0Nd?2{v|7ZiBwNeM=M$l+cRYKy|QIvn74qfLucFYdN2EE0woXb%s-p zy8s`C$qSmgvPv3-ho5%wP;6PU$j4~)H0qUn0lwBvqm5IZ44g_15RE#amNK$J>m5T= zGG$F3Fq2e^VkN}35-k!Y5toWu<2+O|wRV-#PjTJJv>R}A158B$>x*+Fd>QEuNsiSq z2rvz9foysEilBv@Gy!)$GLET+ruMm9DKWV%s@!N#Z1q571Y>QQh$!887-OQX=Kz*> zcX!FM_-Du)!fNrTnJc=Sx+F-u>KzM-uFY!QW-y>{yMx_-)gPapVOxLm`VGMSZDT;l z0z_RpsVsROUE0?0qz|sARA8lb_jcVQ269Zn0u%BS3+Yllz-m#{P=mf8&yS{*OnR@hK|`T{MmRv8iJDIdp$G*T6o7^x#Q>KqbWZ7viWSB? zz>hqz;KjGCEy_5I^9URp%t|vVL}haeM)x2{Ge?ghbst4Ov;^tZVF_0urf3jmOgf9! zF)9?{bjsIiW8BIYXlR8~PV0QqI(J*=UhAB<&hhr3xB{0d@9=vO@#=$mG@)qIrI5t)5xH(CL~FXD)zD?kE#qe)iWz%Y z#>Orsj1-|ni|z?RQ{!@J@s60l(Gr^1UPt1U5fks=BPWn}l+lC$>cY*JaRR@%sBae+52JM`fFTdQ2Y!ON~wQ-aX zUd%J0R(NywvNx{A8m0n9bo0A2tO}Gc3*w1w{SrN&K*Cg4lbEUMM-EU0S>Z(RJY|Pz zDBu+qU3R#L0zaawBa%hid`FsoHqj_k>e>L2rYrbJjahAqMica}V+s|T4px`w_p6>-#_{9 XU;n)He){ejS-@nfx*Te yD6F8bpO>$YoRe5wtdNmflp5g8$OKb>%|MtOgvMulfHx}}NEIUxdI4#FuoeKaiXJ=w literal 0 HcmV?d00001 diff --git a/test/_files/PharModuleGz.phar.gz b/test/_files/PharModuleGz.phar.gz new file mode 100644 index 0000000000000000000000000000000000000000..6e16c07bb1775403d47a5f2d9f2b1f810318dcdd GIT binary patch literal 2529 zcmV<72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Tw&hV_ZkeD&kKtgKP z%o$9fGiS_VKFZ5`w)c!E&x&VEHVd}wP}#_lp=$d^s^!2jIf=_$F)@{$J69fM?L4`X ti!np<(5!B4OZAOAA{doUgvMH5$dhAToFLNE6zE{dz_7o!znKB(4ghU3G`0W$ literal 0 HcmV?d00001 diff --git a/test/_files/PharModuleNestedFake.tar.gz b/test/_files/PharModuleNestedFake.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..9d269d2ce8f1ab2319495f1de27fb57875bce745 GIT binary patch literal 131 zcmb2|=3oE=X6_RnI-kz^Yo7J|>aDBi>09W1#_wu7#|zOE5rY6`35Ld*GbO_c4GfHu z4NOdo4NVQq%}mW$yQHNUZ*sAPY@ExW0o0|#6y?dkn@w@UM)qTyn)dB;ireQ@08~sVZ2$lO literal 0 HcmV?d00001 diff --git a/test/_files/PharModulePharTar.phar.tar b/test/_files/PharModulePharTar.phar.tar new file mode 100644 index 0000000000000000000000000000000000000000..421b63ede72f673e3037f4dd76a1b1b8bd8903b7 GIT binary patch literal 4096 zcmeaxPbtkw)hoy-V4xW=00J{JGYs=V;$UEA%3x?{W@2b+U}|n|!~hgCGc`043 z1A)@wlEfmQl{7GVC>UvD4~%*RF0Q=9+|=TN#N8ocLjxl-gVFk*>M?<7AQMnX1c(CyAF|EN l+OaA8khu}hqr-gJHY_=qsz*geLtr!nMnhmU1cplp002Y3TwMSF literal 0 HcmV?d00001 diff --git a/test/_files/PharModulePharTarBz2.phar.tar.bz2 b/test/_files/PharModulePharTarBz2.phar.tar.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..04944d27d98a5daf04b35b11f77ce8ad87079b4a GIT binary patch literal 318 zcmV-E0m1%4T4*#eL0KkKSw9DC5dZ*)|Gm;01b{^2|BSk3)q(%#-x>h`00BTjA^`#b z2n;X)`qB`IGa(vjrhp9q0iYNV0Bt}cP$bcyG#UZw0MGyc00xGGDMo`30}wO-0j5lY zKmZ1X&Zorl0YRzK7#Sm!&Vy=4A_zrV8d?H(FzO?X0=BMlRhOVj^qzL! zJtHI9=`BRSL1bo-2Ge3t0iRrJAwfaQ;N89XT^1~!eMV3YApny#_!ZtW{22!AN5@;77XM}g8e5m^WK9X60 QCx45%BAh5lAA`0CfGI?RasU7T literal 0 HcmV?d00001 diff --git a/test/_files/PharModulePharTarGz.phar.tar.gz b/test/_files/PharModulePharTarGz.phar.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..cc776967cf574cdee0d38cee2a5aedfbfd49403c GIT binary patch literal 291 zcmV+;0o?u{iwFP!000001M|&KDa}dME66Bdpcya#0y8r+tm0r`X3k(}Xl7z)YG7(^ zZUhoHGc__)Frb~25TLZUB(Vr+B|YpKguuog81)KVTzQGPsl^3}$*Bqf8Hq){;8X!( zg(McaS6Op$CFdj-7b`%-xvFai+S#LkN&uMi6N~hVOG=YyR|XKw|K=v>`QO~g)O=e`ECgZ)jj-W-yxn=>V93SOkb2oFmn} pd!s@UpQtIYt+*z(Pe(U)pxrhKM!_f;1*3p=003Q4HM9T_000L>dkX*n literal 0 HcmV?d00001 diff --git a/test/_files/PharModulePharZip.phar.zip b/test/_files/PharModulePharZip.phar.zip new file mode 100644 index 0000000000000000000000000000000000000000..94361cb01fbb01f1b63b7db45d6139dfc9fa474c GIT binary patch literal 585 zcmWIWW@cdk1M{VJ_ET!IeNBNp5awbKV(`sRDa}dME66CwE9GMd*LG~##t2c(z+ht! z6jtEk%1g{mEiOn*PE`oVNGyWr0I{Mn3#_@gl5-M^ixnWET-CJ!DAvskTU%rUG!KON zfYt#mN-WYZE-6jIXQjTrLRDsgZc<`#YKj6#heBdeazhJX2+Wwt}!Q!sg8Myu^~yqEx-4%sh~f{|nu81gd}n zCLk>W#0I)itTT*H*NVoh-g~g;=*QiQqb~$_GlHbS09#1HJ&+J443 z1A)@wlEfmQl{7GVC>UvD4~%*RF0Q=9+|=TN#N41?M62uWI zDC>R$=U<%)@^?A*EXC~N1*m0XOHov!;Hga}TGcoLU- p_UP0(lOtl*FbFejS-@nfx*Te zD6GK6m6w>CT3nEroT?Czkyr%L5tUhB&Bc|RlUQ7=01@G;t_|>JWP)kNW*JNlLgTYK Sz?+o~q>2#;y?}H!SPKBahAGtm literal 0 HcmV?d00001 diff --git a/test/_files/ZendLoaderAutoloader/Foo.php b/test/_files/ZendLoaderAutoloader/Foo.php new file mode 100644 index 0000000..6c7fa6e --- /dev/null +++ b/test/_files/ZendLoaderAutoloader/Foo.php @@ -0,0 +1,18 @@ + 0) { + foreach ($glob as $file) { + if (!is_dir($file)) { + unlink($file); + } + } + } + $filename = $name . '.phar'; + $phar = new Phar($filename); + switch ($mode) { + case 'normal': + $phar['Module.php'] = "convertToData($format, $compression); + } else { + $phar->setDefaultStub('Module.php', 'Module.php'); + if ($format !== Phar::PHAR || $compression !== Phar::NONE) { + $phar->convertToExecutable($format, $compression); + } + } + if ($format !== Phar::PHAR || $compression !== Phar::NONE) { + unlink($filename); + } + echo "Done!\n"; +} diff --git a/test/_files/badmap.php b/test/_files/badmap.php new file mode 100644 index 0000000..916d122 --- /dev/null +++ b/test/_files/badmap.php @@ -0,0 +1,2 @@ +WJDFr~Khm8Z=TUU0joZ@{@uXC;bZu)|FC@8N zNs7O~7B;Y9NfjH|@(UoPKGbqsPG&(;UAE3W?|be!-<5ZsCiA3LGcNgr z?K0DkJbtwalDS>0`BP^3k?o|Zb8VT)+)2$Q%kq>vp*`cdeVIB*!qd!ZG}wa&%nh6@ zv-y>u<(Xv;B>NWD-qq-#*Yl&Cr!G(O=YGJSFCrI`+qDdu{KyR!9=8)GpG!-NkbK z{#BkjZf;9Gr=x@6XuFp3e33@mwGT2U`<9=GT(}1 ztm8QDk6xa9shBD>=ykS>-FVR-ne6?0wrXgJZE$irG8-b%%kIx&D^C|3u^XWu@(epH zH?xKuB$>%}_gJ@CGhOk`%=uN`P6Ee|Od?iOlcbV)W21`f1cx3SO2x@j&A(72v_x#ei z;H@e8*qr$C<;}&TP%1u4Db;icm!qLaD7l)bT97W#BT-QjLWQUhdTQ2i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