You are here

public function DoctrineCacheTest::testHas in Plug 7

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/Mapping/Cache/DoctrineCacheTest.php, line 41

Class

DoctrineCacheTest

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'));
  $this
    ->assertFalse($this->cache
    ->has('bar'), 'has() returns false when there is no entry');
  $this->cache
    ->write($meta);
  $this
    ->assertTrue($this->cache
    ->has('bar'), 'has() returns true when the is an entry');
}