Skip to content

Commit

Permalink
[FrameworkBundle] Removed detection of Serializer < 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed May 24, 2020
1 parent c08d8d1 commit 9badd71
Showing 1 changed file with 0 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,13 @@
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Adapter\NullAdapter;
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory;
use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader;
use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;

class SerializerCacheWarmerTest extends TestCase
{
public function testWarmUp()
{
if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
$this->markTestSkipped('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2.');
}

$loaders = [
new XmlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/person.xml'),
new YamlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/author.yml'),
Expand Down Expand Up @@ -58,10 +53,6 @@ public function testWarmUp()

public function testWarmUpWithoutLoader()
{
if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
$this->markTestSkipped('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2.');
}

$file = sys_get_temp_dir().'/cache-serializer-without-loader.php';
@unlink($file);

Expand All @@ -84,10 +75,6 @@ public function testWarmUpWithoutLoader()
*/
public function testClassAutoloadException()
{
if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
$this->markTestSkipped('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2.');
}

$this->assertFalse(class_exists($mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_SerializerCacheWarmerTest', false));

$warmer = new SerializerCacheWarmer([new YamlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/does_not_exist.yaml')], tempnam(sys_get_temp_dir(), __FUNCTION__), new ArrayAdapter());
Expand All @@ -112,10 +99,6 @@ public function testClassAutoloadExceptionWithUnrelatedException()
$this->expectException(\DomainException::class);
$this->expectExceptionMessage('This exception should not be caught by the warmer.');

if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
$this->markTestSkipped('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2.');
}

$this->assertFalse(class_exists($mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_SerializerCacheWarmerTest', false));

$warmer = new SerializerCacheWarmer([new YamlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/does_not_exist.yaml')], tempnam(sys_get_temp_dir(), __FUNCTION__), new ArrayAdapter());
Expand Down

0 comments on commit 9badd71

Please sign in to comment.