From 8b63488ac94e6bde374fa4528917427738ef39ca Mon Sep 17 00:00:00 2001 From: blanchonvincent Date: Sun, 3 Mar 2013 12:13:11 +0100 Subject: [PATCH] Add tests on the module loader helper --- .../Test/PHPUnit/Util/ModuleLoaderTest.php | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/ZendTest/Test/PHPUnit/Util/ModuleLoaderTest.php diff --git a/tests/ZendTest/Test/PHPUnit/Util/ModuleLoaderTest.php b/tests/ZendTest/Test/PHPUnit/Util/ModuleLoaderTest.php new file mode 100644 index 00000000000..d4907960597 --- /dev/null +++ b/tests/ZendTest/Test/PHPUnit/Util/ModuleLoaderTest.php @@ -0,0 +1,54 @@ +loadModule('Baz'); + + $baz = $this->getModule('Baz'); + $this->assertTrue($baz instanceof \Baz\Module); + } + + public function testCanLoadModuleWithPath() + { + $this->loadModule(array('Baz' => __DIR__ . '/../../_files/Baz')); + } + + public function testCanLoadModules() + { + require_once __DIR__ . '/../../_files/Baz/Module.php'; + require_once __DIR__ . '/../../_files/modules-path/with-subdir/Foo/Module.php'; + + $this->loadModules(array('Baz', 'Foo')); + } + + public function testCanLoadModulesWithPath() + { + $this->loadModules(array( + 'Baz' => __DIR__ . '/../../_files/Baz', + 'Foo' => __DIR__ . '/../../_files/modules-path/with-subdir/Foo', + )); + + $fooObject = $this->getServiceManager()->get('FooObject'); + $this->assertTrue($fooObject instanceof \stdClass); + } + + public function testCanLoadModulesFromConfig() + { + $config = include __DIR__ . '/../../_files/application.config.php'; + $this->loadModulesFromConfig($config); + } +}