Skip to content

Commit

Permalink
Unregister AutoloaderFactory autoloaders in tearDown in module manage…
Browse files Browse the repository at this point in the history
…r tests
  • Loading branch information
EvanDotPro committed Nov 14, 2011
1 parent a499ae8 commit 17a0029
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions tests/Zend/Module/Listener/AutoloaderListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use PHPUnit_Framework_TestCase as TestCase,
Zend\Loader\ModuleAutoloader,
Zend\Loader\AutoloaderFactory,
Zend\Module\Listener\AutoloaderListener,
Zend\Module\Manager;

Expand All @@ -30,6 +31,7 @@ public function setUp()
public function tearDown()
{
// Restore original autoloaders
AutoloaderFactory::unregisterAutoloaders();
$loaders = spl_autoload_functions();
if (is_array($loaders)) {
foreach ($loaders as $loader) {
Expand Down
4 changes: 2 additions & 2 deletions tests/Zend/Module/Listener/ConfigListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Zend\Module\Manager,
Zend\Module\Listener\ConfigListener,
Zend\Module\Listener\ListenerOptions,
Zend\Loader\AutoloaderFactory,
InvalidArgumentException;

class ConfigListenerTest extends TestCase
Expand All @@ -31,8 +32,6 @@ public function setUp()
dirname(__DIR__) . '/TestAsset',
));
$autoloader->register();
\AutoInstallModule\Module::$RESPONSE = true;
\AutoInstallModule\Module::$VERSION = '1.0.0';
}

public function tearDown()
Expand All @@ -41,6 +40,7 @@ public function tearDown()
@unlink($file[0]); // change this if there's ever > 1 file
@rmdir($this->tmpdir);
// Restore original autoloaders
AutoloaderFactory::unregisterAutoloaders();
$loaders = spl_autoload_functions();
if (is_array($loaders)) {
foreach ($loaders as $loader) {
Expand Down
2 changes: 2 additions & 0 deletions tests/Zend/Module/Listener/InitTriggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use PHPUnit_Framework_TestCase as TestCase,
Zend\Loader\ModuleAutoloader,
Zend\Loader\AutoloaderFactory,
Zend\Module\Listener\InitTrigger,
Zend\Module\Manager;

Expand All @@ -30,6 +31,7 @@ public function setUp()
public function tearDown()
{
// Restore original autoloaders
AutoloaderFactory::unregisterAutoloaders();
$loaders = spl_autoload_functions();
if (is_array($loaders)) {
foreach ($loaders as $loader) {
Expand Down
4 changes: 2 additions & 2 deletions tests/Zend/Module/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use PHPUnit_Framework_TestCase as TestCase,
Zend\Loader\ModuleAutoloader,
Zend\Loader\AutoloaderFactory,
Zend\Module\Manager,
Zend\Module\Listener\ListenerOptions,
InvalidArgumentException;
Expand All @@ -30,8 +31,6 @@ public function setUp()
__DIR__ . '/TestAsset',
));
$autoloader->register();
\AutoInstallModule\Module::$RESPONSE = true;
\AutoInstallModule\Module::$VERSION = '1.0.0';
}

public function tearDown()
Expand All @@ -40,6 +39,7 @@ public function tearDown()
@unlink($file[0]); // change this if there's ever > 1 file
@rmdir($this->tmpdir);
// Restore original autoloaders
AutoloaderFactory::unregisterAutoloaders();
$loaders = spl_autoload_functions();
if (is_array($loaders)) {
foreach ($loaders as $loader) {
Expand Down

0 comments on commit 17a0029

Please sign in to comment.