15
15
use Symfony \Bundle \FrameworkBundle \Tests \TestCase ;
16
16
use Symfony \Component \Cache \Adapter \NullAdapter ;
17
17
use Symfony \Component \Cache \Adapter \PhpArrayAdapter ;
18
- use Symfony \Component \Serializer \Mapping \Factory \CacheClassMetadataFactory ;
19
18
use Symfony \Component \Serializer \Mapping \Loader \XmlFileLoader ;
20
19
use Symfony \Component \Serializer \Mapping \Loader \YamlFileLoader ;
21
20
22
21
class SerializerCacheWarmerTest extends TestCase
23
22
{
24
23
public function testWarmUp ()
25
24
{
26
- if (!class_exists (CacheClassMetadataFactory::class) || !method_exists (XmlFileLoader::class, 'getMappedClasses ' ) || !method_exists (YamlFileLoader::class, 'getMappedClasses ' )) {
27
- $ this ->markTestSkipped ('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2. ' );
28
- }
29
-
30
25
$ loaders = [
31
26
new XmlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/person.xml ' ),
32
27
new YamlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/author.yml ' ),
@@ -48,10 +43,6 @@ public function testWarmUp()
48
43
49
44
public function testWarmUpWithoutLoader ()
50
45
{
51
- if (!class_exists (CacheClassMetadataFactory::class) || !method_exists (XmlFileLoader::class, 'getMappedClasses ' ) || !method_exists (YamlFileLoader::class, 'getMappedClasses ' )) {
52
- $ this ->markTestSkipped ('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2. ' );
53
- }
54
-
55
46
$ file = sys_get_temp_dir ().'/cache-serializer-without-loader.php ' ;
56
47
@unlink ($ file );
57
48
@@ -67,10 +58,6 @@ public function testWarmUpWithoutLoader()
67
58
*/
68
59
public function testClassAutoloadException ()
69
60
{
70
- if (!class_exists (CacheClassMetadataFactory::class) || !method_exists (XmlFileLoader::class, 'getMappedClasses ' ) || !method_exists (YamlFileLoader::class, 'getMappedClasses ' )) {
71
- $ this ->markTestSkipped ('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2. ' );
72
- }
73
-
74
61
$ this ->assertFalse (class_exists ($ mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_SerializerCacheWarmerTest ' , false ));
75
62
76
63
$ warmer = new SerializerCacheWarmer ([new YamlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/does_not_exist.yaml ' )], tempnam (sys_get_temp_dir (), __FUNCTION__ ));
@@ -95,10 +82,6 @@ public function testClassAutoloadExceptionWithUnrelatedException()
95
82
$ this ->expectException (\DomainException::class);
96
83
$ this ->expectExceptionMessage ('This exception should not be caught by the warmer. ' );
97
84
98
- if (!class_exists (CacheClassMetadataFactory::class) || !method_exists (XmlFileLoader::class, 'getMappedClasses ' ) || !method_exists (YamlFileLoader::class, 'getMappedClasses ' )) {
99
- $ this ->markTestSkipped ('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2. ' );
100
- }
101
-
102
85
$ this ->assertFalse (class_exists ($ mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_SerializerCacheWarmerTest ' , false ));
103
86
104
87
$ warmer = new SerializerCacheWarmer ([new YamlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/does_not_exist.yaml ' )], tempnam (sys_get_temp_dir (), __FUNCTION__ ));
0 commit comments