1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 08:32:56 +00:00

Add --apcu-autoloader option to enable APCu caching of found/not-found classes

This commit is contained in:
Nicolas Grekas 2016-07-28 10:23:39 +02:00
parent fb6f6fd26c
commit 6d4e60b991
14 changed files with 104 additions and 1 deletions

View file

@ -508,9 +508,10 @@ class AutoloadGeneratorTest extends TestCase
);
$this->assertAutoloadFiles('classmap5', $this->vendorDir.'/composer', 'classmap');
$this->assertNotContains('$loader->setClassMapAuthoritative(true);', file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
$this->assertNotContains('$loader->setApcuPrefix(', file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
}
public function testClassMapAutoloadingAuthoritative()
public function testClassMapAutoloadingAuthoritativeAndApcu()
{
$package = new Package('a', '1.0', '1.0');
@ -535,6 +536,7 @@ class AutoloadGeneratorTest extends TestCase
file_put_contents($this->vendorDir.'/c/c/foo/ClassMapBaz.php', '<?php class ClassMapBaz {}');
$this->generator->setClassMapAuthoritative(true);
$this->generator->setApcu(true);
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, '_7');
$this->assertTrue(file_exists($this->vendorDir.'/composer/autoload_classmap.php'), "ClassMap file needs to be generated.");
@ -549,6 +551,7 @@ class AutoloadGeneratorTest extends TestCase
$this->assertAutoloadFiles('classmap8', $this->vendorDir.'/composer', 'classmap');
$this->assertContains('$loader->setClassMapAuthoritative(true);', file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
$this->assertContains('$loader->setApcuPrefix(', file_get_contents($this->vendorDir.'/composer/autoload_real.php'));
}
public function testFilesAutoloadGeneration()