You are here

public function LegacyApcCacheTest::testHas in Plug 7

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/Mapping/Cache/LegacyApcCacheTest.php, line 47

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');
}