Skip to content

Commit

Permalink
moar AbstractModule tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefano Torresi committed Mar 4, 2014
1 parent 579ecd0 commit 7feb135
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/Test/AbstractModuleTest.php
Expand Up @@ -61,4 +61,21 @@ public function testPrefixedPSR0Configuration()
$autoloaderConfig['Zend\Loader\StandardAutoloader']['namespaces'][$module->getNamespace()]
);
}

public function testInvalidModuleThrowsException()
{
$this->setExpectedException('RuntimeException', "Could not detect module root directory. Please either use PSR-0 or PSR-4 structure.");
include __DIR__ . '/TestAsset/invalid-module-dir/Module.php';
$invalidModule = new \InvalidModule\Module();
}

public function testGetConfig()
{
$module = new \SamplePSR0Module\Module();

$config = $module->getConfig();

$this->assertContains('module-config', $config);
$this->assertContains('some-config', $config);
}
}
10 changes: 10 additions & 0 deletions tests/Test/TestAsset/SamplePSR0Module/config/module.config.php
@@ -0,0 +1,10 @@
<?php
/**
* @author Stefano Torresi (http://stefanotorresi.it)
* @license See the file LICENSE.txt for copying permission.
* ************************************************
*/

return [
'module-config'
];
9 changes: 9 additions & 0 deletions tests/Test/TestAsset/SamplePSR0Module/config/some.config.php
@@ -0,0 +1,9 @@
<?php
/**
* @author Stefano Torresi (http://stefanotorresi.it)
* @license See the file LICENSE.txt for copying permission.
* ************************************************
*/
return [
'some-config'
];
15 changes: 15 additions & 0 deletions tests/Test/TestAsset/invalid-module-dir/Module.php
@@ -0,0 +1,15 @@
<?php
/**
* @author Stefano Torresi (http://stefanotorresi.it)
* @license See the file LICENSE.txt for copying permission.
* ************************************************
*/

namespace InvalidModule;

use MyBase\AbstractModule;

class Module extends AbstractModule
{

}

0 comments on commit 7feb135

Please sign in to comment.