You are here

public function LegacyApcCacheTest::testHas in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Tests/Mapping/Cache/LegacyApcCacheTest.php \Symfony\Component\Validator\Tests\Mapping\Cache\LegacyApcCacheTest::testHas()

File

vendor/symfony/validator/Tests/Mapping/Cache/LegacyApcCacheTest.php, line 45

Class

LegacyApcCacheTest
@group legacy

Namespace

Symfony\Component\Validator\Tests\Mapping\Cache

Code

public function testHas() {
  $meta = $this
    ->getMockBuilder('Symfony\\Component\\Validator\\Mapping\\ClassMetadata')
    ->disableOriginalConstructor()
    ->setMethods(array(
    'getClassName',
  ))
    ->getMock();
  $meta
    ->expects($this
    ->once())
    ->method('getClassName')
    ->will($this
    ->returnValue('bar'));
  apc_delete('foobar');
  $cache = new ApcCache('foo');
  $this
    ->assertFalse($cache
    ->has('bar'), '->has() returns false when there is no entry');
  $cache
    ->write($meta);
  $this
    ->assertTrue($cache
    ->has('bar'), '->has() returns true when the is an entry');
}