16
16
use Symfony \Component \Cache \Adapter \ArrayAdapter ;
17
17
use Symfony \Component \Cache \Adapter \NullAdapter ;
18
18
use Symfony \Component \Cache \Adapter \PhpArrayAdapter ;
19
- use Symfony \Component \Serializer \Mapping \Factory \CacheClassMetadataFactory ;
20
19
use Symfony \Component \Serializer \Mapping \Loader \XmlFileLoader ;
21
20
use Symfony \Component \Serializer \Mapping \Loader \YamlFileLoader ;
22
21
23
22
class SerializerCacheWarmerTest extends TestCase
24
23
{
25
24
public function testWarmUp ()
26
25
{
27
- if (!class_exists (CacheClassMetadataFactory::class) || !method_exists (XmlFileLoader::class, 'getMappedClasses ' ) || !method_exists (YamlFileLoader::class, 'getMappedClasses ' )) {
28
- $ this ->markTestSkipped ('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2. ' );
29
- }
30
-
31
26
$ loaders = [
32
27
new XmlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/person.xml ' ),
33
28
new YamlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/author.yml ' ),
@@ -58,10 +53,6 @@ public function testWarmUp()
58
53
59
54
public function testWarmUpWithoutLoader ()
60
55
{
61
- if (!class_exists (CacheClassMetadataFactory::class) || !method_exists (XmlFileLoader::class, 'getMappedClasses ' ) || !method_exists (YamlFileLoader::class, 'getMappedClasses ' )) {
62
- $ this ->markTestSkipped ('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2. ' );
63
- }
64
-
65
56
$ file = sys_get_temp_dir ().'/cache-serializer-without-loader.php ' ;
66
57
@unlink ($ file );
67
58
@@ -84,10 +75,6 @@ public function testWarmUpWithoutLoader()
84
75
*/
85
76
public function testClassAutoloadException ()
86
77
{
87
- if (!class_exists (CacheClassMetadataFactory::class) || !method_exists (XmlFileLoader::class, 'getMappedClasses ' ) || !method_exists (YamlFileLoader::class, 'getMappedClasses ' )) {
88
- $ this ->markTestSkipped ('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2. ' );
89
- }
90
-
91
78
$ this ->assertFalse (class_exists ($ mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_SerializerCacheWarmerTest ' , false ));
92
79
93
80
$ warmer = new SerializerCacheWarmer ([new YamlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/does_not_exist.yaml ' )], tempnam (sys_get_temp_dir (), __FUNCTION__ ), new ArrayAdapter ());
@@ -112,10 +99,6 @@ public function testClassAutoloadExceptionWithUnrelatedException()
112
99
$ this ->expectException (\DomainException::class);
113
100
$ this ->expectExceptionMessage ('This exception should not be caught by the warmer. ' );
114
101
115
- if (!class_exists (CacheClassMetadataFactory::class) || !method_exists (XmlFileLoader::class, 'getMappedClasses ' ) || !method_exists (YamlFileLoader::class, 'getMappedClasses ' )) {
116
- $ this ->markTestSkipped ('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2. ' );
117
- }
118
-
119
102
$ this ->assertFalse (class_exists ($ mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_SerializerCacheWarmerTest ' , false ));
120
103
121
104
$ warmer = new SerializerCacheWarmer ([new YamlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/does_not_exist.yaml ' )], tempnam (sys_get_temp_dir (), __FUNCTION__ ), new ArrayAdapter ());
0 commit comments