Skip to content

Commit 566f2c4

Browse files
committed
test Autoloader::initialize() with composer path not found
1 parent ca3ed2f commit 566f2c4

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/system/Autoloader/AutoloaderTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,4 +232,22 @@ public function testFindsComposerRoutes()
232232
$namespaces = $this->loader->getNamespace();
233233
$this->assertArrayHasKey('Laminas\\Escaper', $namespaces);
234234
}
235+
236+
public function testFindsComposerRoutesWithComposerPathNotFound()
237+
{
238+
$composerPath = COMPOSER_PATH;
239+
240+
$config = new Autoload();
241+
$moduleConfig = new Modules();
242+
$moduleConfig->discoverInComposer = true;
243+
244+
$this->loader = new Autoloader();
245+
246+
rename(COMPOSER_PATH, COMPOSER_PATH . '.backup');
247+
$this->loader->initialize($config, $moduleConfig);
248+
rename(COMPOSER_PATH . '.backup', $composerPath);
249+
250+
$namespaces = $this->loader->getNamespace();
251+
$this->assertArrayNotHasKey('Laminas\\Escaper', $namespaces);
252+
}
235253
}

0 commit comments

Comments
 (0)