Skip to content

Commit

Permalink
Fix tests for Symfony < 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
GeLoLabs committed Feb 21, 2017
1 parent b02c720 commit 8a33b64
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Tests/DependencyInjection/AbstractIvorySerializerExtensionTest.php
Expand Up @@ -229,7 +229,11 @@ public function testMappingCache()
(string) $classMetadataFactoryDefinition->getArgument(0)
);

$this->assertSame('cache.system', (string) $classMetadataFactoryDefinition->getArgument(1));
$this->assertSame(
class_exists(CachePoolPass::class) ? 'cache.system' : 'ivory.serializer.cache',
(string) $classMetadataFactoryDefinition->getArgument(1)
);

$this->assertSame('ivory_serializer', $classMetadataFactoryDefinition->getArgument(2));

$this->assertInstanceOf(
Expand All @@ -240,7 +244,7 @@ public function testMappingCache()

public function testCustomMappingCache()
{
$this->container->set('cache.custom', $this->createCacheItemPoolMock());
$this->container->setDefinition('cache.custom', new Definition($this->createCacheItemPoolMockClass()));
$this->loadConfiguration($this->container, 'mapping_cache');
$this->container->compile();

Expand Down Expand Up @@ -545,6 +549,14 @@ private function loadService($service)
$loader->load($service.'.xml');
}

/**
* @return string
*/
private function createCacheItemPoolMockClass()
{
return $this->getMockClass(CacheItemPoolInterface::class);
}

/**
* @return \PHPUnit_Framework_MockObject_MockObject|CacheItemPoolInterface
*/
Expand Down

0 comments on commit 8a33b64

Please sign in to comment.