@@ -51,6 +51,39 @@ public function testWarmUp()
5151 $ this ->assertArrayHasKey ('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Author ' , $ values );
5252 }
5353
54+ public function testWarmUpWithAnnotations ()
55+ {
56+ $ validatorBuilder = new ValidatorBuilder ();
57+ $ validatorBuilder ->addYamlMapping (__DIR__ .'/../Fixtures/Validation/Resources/categories.yml ' );
58+ $ validatorBuilder ->enableAnnotationMapping ();
59+
60+ $ file = sys_get_temp_dir ().'/cache-validator-with-annotations.php ' ;
61+ @unlink ($ file );
62+
63+ $ fallbackPool = new ArrayAdapter ();
64+
65+ $ warmer = new ValidatorCacheWarmer ($ validatorBuilder , $ file , $ fallbackPool );
66+ $ warmer ->warmUp (dirname ($ file ));
67+
68+ $ this ->assertFileExists ($ file );
69+
70+ $ values = require $ file ;
71+
72+ $ this ->assertInternalType ('array ' , $ values );
73+ $ this ->assertCount (1 , $ values );
74+ $ this ->assertArrayHasKey ('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Category ' , $ values );
75+
76+ // Simple check to make sure that at least one constraint is actually cached, in this case the "id" property Type.
77+ $ this ->assertContains ('"int" ' , $ values ['Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Category ' ]);
78+
79+ $ values = $ fallbackPool ->getValues ();
80+
81+ $ this ->assertInternalType ('array ' , $ values );
82+ $ this ->assertCount (2 , $ values );
83+ $ this ->assertArrayHasKey ('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Category ' , $ values );
84+ $ this ->assertArrayHasKey ('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.SubCategory ' , $ values );
85+ }
86+
5487 public function testWarmUpWithoutLoader ()
5588 {
5689 $ validatorBuilder = new ValidatorBuilder ();
0 commit comments