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 \Loader \LoaderChain ;
18
19
use Symfony \Component \Serializer \Mapping \Loader \XmlFileLoader ;
19
20
use Symfony \Component \Serializer \Mapping \Loader \YamlFileLoader ;
20
21
21
22
class SerializerCacheWarmerTest extends TestCase
22
23
{
23
- public function testWarmUp ()
24
+ /**
25
+ * @dataProvider loaderProvider
26
+ */
27
+ public function testWarmUp (array $ loaders )
24
28
{
25
- $ loaders = [
26
- new XmlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/person.xml ' ),
27
- new YamlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/author.yml ' ),
28
- ];
29
-
30
29
$ file = sys_get_temp_dir ().'/cache-serializer.php ' ;
31
30
@unlink ($ file );
32
31
@@ -41,6 +40,26 @@ public function testWarmUp()
41
40
$ this ->assertTrue ($ arrayPool ->getItem ('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Author ' )->isHit ());
42
41
}
43
42
43
+ public function loaderProvider ()
44
+ {
45
+ return [
46
+ [
47
+ [
48
+ new LoaderChain ([
49
+ new XmlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/person.xml ' ),
50
+ new YamlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/author.yml ' ),
51
+ ]),
52
+ ],
53
+ ],
54
+ [
55
+ [
56
+ new XmlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/person.xml ' ),
57
+ new YamlFileLoader (__DIR__ .'/../Fixtures/Serialization/Resources/author.yml ' ),
58
+ ],
59
+ ],
60
+ ];
61
+ }
62
+
44
63
public function testWarmUpWithoutLoader ()
45
64
{
46
65
$ file = sys_get_temp_dir ().'/cache-serializer-without-loader.php ' ;
0 commit comments