1515use Symfony \Component \Form \Exception \TransformationFailedException ;
1616use Symfony \Component \Form \Extension \Core \DataTransformer \UuidToStringTransformer ;
1717use Symfony \Component \Uid \Uuid ;
18+ use Symfony \Component \Uid \UuidV1 ;
1819
1920class UuidToStringTransformerTest extends TestCase
2021{
21- public function provideValidUuid ()
22- {
23- return [
24- ['123e4567-e89b-12d3-a456-426655440000 ' , new Uuid ('123e4567-e89b-12d3-a456-426655440000 ' )],
25- ];
26- }
27-
28- /**
29- * @dataProvider provideValidUuid
30- */
31- public function testTransform ($ output , $ input )
22+ public function testTransform ()
3223 {
3324 $ transformer = new UuidToStringTransformer ();
3425
35- $ input = new Uuid ($ input );
36-
37- $ this ->assertEquals ($ output , $ transformer ->transform ($ input ));
26+ $ this ->assertEquals ('123e4567-e89b-12d3-a456-426655440000 ' , $ transformer ->transform (new UuidV1 ('123e4567-e89b-12d3-a456-426655440000 ' )));
3827 }
3928
4029 public function testTransformEmpty ()
@@ -53,16 +42,11 @@ public function testTransformExpectsUuid()
5342 $ transformer ->transform ('1234 ' );
5443 }
5544
56- /**
57- * @dataProvider provideValidUuid
58- */
59- public function testReverseTransform ($ input , $ output )
45+ public function testReverseTransform ()
6046 {
61- $ reverseTransformer = new UuidToStringTransformer ();
62-
63- $ output = new Uuid ($ output );
47+ $ transformer = new UuidToStringTransformer ();
6448
65- $ this ->assertEquals ($ output , $ reverseTransformer ->reverseTransform ($ input ));
49+ $ this ->assertEquals (new UuidV1 ( ' 123e4567-e89b-12d3-a456-426655440000 ' ) , $ transformer ->reverseTransform (' 123e4567-e89b-12d3-a456-426655440000 ' ));
6650 }
6751
6852 public function testReverseTransformEmpty ()
@@ -78,7 +62,7 @@ public function testReverseTransformExpectsString()
7862
7963 $ this ->expectException (TransformationFailedException::class);
8064
81- $ reverseTransformer ->reverseTransform (1234 );
65+ $ reverseTransformer ->reverseTransform (Uuid:: fromString ( ' 123e4567-e89b-12d3-a456-426655440000 ' )-> toBase32 () );
8266 }
8367
8468 public function testReverseTransformExpectsValidUuidString ()
0 commit comments