Skip to content

Commit

Permalink
Add tests on the module loader helper
Browse files Browse the repository at this point in the history
  • Loading branch information
blanchonvincent committed Mar 3, 2013
1 parent ff400af commit 8b63488
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions tests/ZendTest/Test/PHPUnit/Util/ModuleLoaderTest.php
@@ -0,0 +1,54 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ZendTest\Test\PHPUnit\Util;

use Zend\Test\PHPUnit\Util\ModuleLoader;

class ModuleLoaderTest extends ModuleLoader
{
public function testCanLoadModule()
{
require_once __DIR__ . '/../../_files/Baz/Module.php';

$this->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);
}
}

0 comments on commit 8b63488

Please sign in to comment.