Skip to content

Commit

Permalink
Merge pull request #2791 from samsonasik/test-autoloader-composer-pat…
Browse files Browse the repository at this point in the history
…h-not-found

test Autoloader::initialize() with composer path not found
  • Loading branch information
MGatner authored Apr 3, 2020
2 parents c1aa6f3 + 566f2c4 commit 89c7b17
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/system/Autoloader/AutoloaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,22 @@ public function testFindsComposerRoutes()
$namespaces = $this->loader->getNamespace();
$this->assertArrayHasKey('Laminas\\Escaper', $namespaces);
}

public function testFindsComposerRoutesWithComposerPathNotFound()
{
$composerPath = COMPOSER_PATH;

$config = new Autoload();
$moduleConfig = new Modules();
$moduleConfig->discoverInComposer = true;

$this->loader = new Autoloader();

rename(COMPOSER_PATH, COMPOSER_PATH . '.backup');
$this->loader->initialize($config, $moduleConfig);
rename(COMPOSER_PATH . '.backup', $composerPath);

$namespaces = $this->loader->getNamespace();
$this->assertArrayNotHasKey('Laminas\\Escaper', $namespaces);
}
}

0 comments on commit 89c7b17

Please sign in to comment.