* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Config\Tests\Resource; use PHPUnit\Framework\TestCase; use Symfony\Component\Config\Resource\ClassExistenceResource; use Symfony\Component\Config\Tests\Fixtures\Resource\ConditionalClass; use Symfony\Component\Config\Tests\Fixtures\BadParent; class ClassExistenceResourceTest extends TestCase { public function testToString() { $res = new ClassExistenceResource('BarClass'); $this->assertSame('BarClass', (string) $res); } public function testGetResource() { $res = new ClassExistenceResource('BarClass'); $this->assertSame('BarClass', $res->getResource()); } public function testIsFreshWhenClassDoesNotExist() { $res = new ClassExistenceResource('Symfony\Component\Config\Tests\Fixtures\BarClass'); $this->assertTrue($res->isFresh(time())); eval(<<assertFalse($res->isFresh(time())); } public function testIsFreshWhenClassExists() { $res = new ClassExistenceResource('Symfony\Component\Config\Tests\Resource\ClassExistenceResourceTest'); $this->assertTrue($res->isFresh(time())); } public function testExistsKo() { spl_autoload_register($autoloader = function ($class) use (&$loadedClass) { $loadedClass = $class; }); try { $res = new ClassExistenceResource('MissingFooClass'); $this->assertTrue($res->isFresh(0)); $this->assertSame('MissingFooClass', $loadedClass); $loadedClass = 123; $res = new ClassExistenceResource('MissingFooClass', false); $this->assertSame(123, $loadedClass); } finally { spl_autoload_unregister($autoloader); } } public function testBadParentWithTimestamp() { $res = new ClassExistenceResource(BadParent::class, false); $this->assertTrue($res->isFresh(time())); } /** * @expectedException \ReflectionException * @expectedExceptionMessage Class Symfony\Component\Config\Tests\Fixtures\MissingParent not found */ public function testBadParentWithNoTimestamp() { $res = new ClassExistenceResource(BadParent::class, false); $res->isFresh(0); } public function testConditionalClass() { $res = new ClassExistenceResource(ConditionalClass::class, false); $this->assertFalse($res->isFresh(0)); } } __halt_compiler();----SIGNATURE:----GUHTajNVrOtefYQUUSZazIV2+V8m/Q58nfHzFmKm1PU8GkiLYVCwoCzndTL/7qrNGDvFGsMcT431TGrW5xCD4epRUwR8Pqpq7Df8WtjU+xyeUoCOjdoEo/K1WIo7w0oUbH/RQrgEoNZ/0hDcsiIwUVP7lRy7FX4w12WVi92kBMmIhmbsoVDhzKJLUfgQ8J5+wQ1ar2ZpYihC9KY0oBHnOgQYD/QY/SBDUEBbAZodJHUzKv0PevlZluLzVEk3zvRTHtI0S1mn+ewXwY4ABHcIxsOuEOvK3eWp1IEydP4TSMpnp2H8PF7lOdDURMemnEPitrZBh4Glwdr+YKVtnTpJXsaNgDlURQ3t9UKnAKSsG3KFRtGdpbR6ZAQNE4KjKMlGn0cYIjRbPakWtQmqgD0TMHGLHmujRvJu34A8HBEHLDmpIsBoFG5WZGdulnP6XtcS3qO9wLXrExfT4HJUTdGMbhI5Sy4nVzupqngr0PaA99v016SGYzDoczIcm6NEk9WH5xDZILq2NUbfOX8QSdZgszLfGB6SZhnxW4wM70Y3w1KU4+6X2MKDJ89wpaa1JTjgo5f5Ij7/XBMYd2I1dtbLrKeTTDhBChr1PeYz92lJBVbV8v1Dzf0rXukk1fGrcR69/I5McmvfYGxeCA2bjn8uX/bw7rF0p70GCdFtZ5LzwdY=----ATTACHMENT:----NzM4NDk0NjQ5NDUyNDQ4NyA4NTQ5NDAyOTA4NjY4MzE0IDMzNzg4NzAwNzUwMjk0NTg=