mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
Updating Symfony lib and dependencies:
Package operations: 2 installs, 23 updates, 0 removals - Updating psr/log (1.1.0 => 1.1.2) - Updating symfony/debug (v3.4.30 => v3.4.35) - Updating symfony/console (v3.4.30 => v3.4.35) - Updating symfony/dotenv (v3.4.30 => v3.4.35) - Updating symfony/routing (v3.4.30 => v3.4.35) - Updating symfony/finder (v3.4.30 => v3.4.35) - Updating symfony/filesystem (v3.4.30 => v3.4.35) - Installing symfony/polyfill-util (v1.12.0) - Installing symfony/polyfill-php56 (v1.12.0) - Updating symfony/http-foundation (v3.4.30 => v3.4.35) - Updating symfony/event-dispatcher (v3.4.30 => v3.4.35) - Updating symfony/http-kernel (v3.4.30 => v3.4.35) - Updating symfony/config (v3.4.30 => v3.4.35) - Updating symfony/dependency-injection (v3.4.30 => v3.4.35) - Updating symfony/class-loader (v3.4.30 => v3.4.35) - Updating symfony/cache (v3.4.30 => v3.4.35) - Updating symfony/framework-bundle (v3.4.30 => v3.4.35) - Updating twig/twig (v1.42.2 => v1.42.4) - Updating symfony/twig-bridge (v3.4.30 => v3.4.35) - Updating symfony/twig-bundle (v3.4.30 => v3.4.35) - Updating symfony/yaml (v3.4.30 => v3.4.35) - Updating symfony/stopwatch (v3.4.30 => v3.4.35) - Updating symfony/var-dumper (v3.4.30 => v3.4.35) - Updating symfony/web-profiler-bundle (v3.4.30 => v3.4.35) - Updating symfony/css-selector (v3.4.30 => v3.4.35)
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
|
||||
use Doctrine\Common\Annotations\AnnotationReader;
|
||||
use Doctrine\Common\Annotations\CachedReader;
|
||||
use Doctrine\Common\Annotations\Reader;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer;
|
||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
||||
@@ -86,7 +87,55 @@ class AnnotationsCacheWarmerTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|Reader
|
||||
* Test that the cache warming process is not broken if a class loader
|
||||
* throws an exception (on class / file not found for example).
|
||||
*/
|
||||
public function testClassAutoloadException()
|
||||
{
|
||||
$this->assertFalse(class_exists($annotatedClass = 'C\C\C', false));
|
||||
|
||||
file_put_contents($this->cacheDir.'/annotations.map', sprintf('<?php return %s;', var_export([$annotatedClass], true)));
|
||||
$warmer = new AnnotationsCacheWarmer(new AnnotationReader(), tempnam($this->cacheDir, __FUNCTION__), new ArrayAdapter());
|
||||
|
||||
spl_autoload_register($classLoader = function ($class) use ($annotatedClass) {
|
||||
if ($class === $annotatedClass) {
|
||||
throw new \DomainException('This exception should be caught by the warmer.');
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
$warmer->warmUp($this->cacheDir);
|
||||
|
||||
spl_autoload_unregister($classLoader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the cache warming process is broken if a class loader throws an
|
||||
* exception but that is unrelated to the class load.
|
||||
*/
|
||||
public function testClassAutoloadExceptionWithUnrelatedException()
|
||||
{
|
||||
$this->expectException(\DomainException::class);
|
||||
$this->expectExceptionMessage('This exception should not be caught by the warmer.');
|
||||
|
||||
$this->assertFalse(class_exists($annotatedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_AnnotationsCacheWarmerTest', false));
|
||||
|
||||
file_put_contents($this->cacheDir.'/annotations.map', sprintf('<?php return %s;', var_export([$annotatedClass], true)));
|
||||
$warmer = new AnnotationsCacheWarmer(new AnnotationReader(), tempnam($this->cacheDir, __FUNCTION__), new ArrayAdapter());
|
||||
|
||||
spl_autoload_register($classLoader = function ($class) use ($annotatedClass) {
|
||||
if ($class === $annotatedClass) {
|
||||
eval('class '.$annotatedClass.'{}');
|
||||
throw new \DomainException('This exception should not be caught by the warmer.');
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
$warmer->warmUp($this->cacheDir);
|
||||
|
||||
spl_autoload_unregister($classLoader);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MockObject|Reader
|
||||
*/
|
||||
private function getReadOnlyReader()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user