90
90
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyDtoCustom ;
91
91
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyDtoNoInput ;
92
92
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyDtoNoOutput ;
93
+ use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyDtoOutputFallbackToSameClass ;
93
94
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyDtoOutputSameClass ;
94
95
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyFriend ;
95
96
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \DummyGroup ;
@@ -591,7 +592,7 @@ public function thereAreDummyObjectsWithDummyDate(int $nb)
591
592
$ descriptions = ['Smart dummy. ' , 'Not so smart dummy. ' ];
592
593
593
594
for ($ i = 1 ; $ i <= $ nb ; ++$ i ) {
594
- $ date = new \ DateTime (sprintf ('2015-04-%d ' , $ i ), new \ DateTimeZone ('UTC ' ));
595
+ $ date = new DateTime (sprintf ('2015-04-%d ' , $ i ), new DateTimeZone ('UTC ' ));
595
596
596
597
$ dummy = $ this ->buildDummy ();
597
598
$ dummy ->setName ('Dummy # ' .$ i );
@@ -622,11 +623,11 @@ public function thereAreDummyObjectsWithDummyDateAndDummyBoolean(int $nb, string
622
623
$ bool = false ;
623
624
} else {
624
625
$ expected = ['true ' , 'false ' , '1 ' , '0 ' ];
625
- throw new \ InvalidArgumentException (sprintf ('Invalid boolean value for "%s" property, expected one of ( "%s" ) ' , $ bool , implode ('" | " ' , $ expected )));
626
+ throw new InvalidArgumentException (sprintf ('Invalid boolean value for "%s" property, expected one of ( "%s" ) ' , $ bool , implode ('" | " ' , $ expected )));
626
627
}
627
628
628
629
for ($ i = 1 ; $ i <= $ nb ; ++$ i ) {
629
- $ date = new \ DateTime (sprintf ('2015-04-%d ' , $ i ), new \ DateTimeZone ('UTC ' ));
630
+ $ date = new DateTime (sprintf ('2015-04-%d ' , $ i ), new DateTimeZone ('UTC ' ));
630
631
631
632
$ dummy = $ this ->buildDummy ();
632
633
$ dummy ->setName ('Dummy # ' .$ i );
@@ -651,7 +652,7 @@ public function thereAreDummyObjectsWithDummyDateAndDummyBoolean(int $nb, string
651
652
public function thereAreDummyObjectsWithDummyDateAndRelatedDummy (int $ nb )
652
653
{
653
654
for ($ i = 1 ; $ i <= $ nb ; ++$ i ) {
654
- $ date = new \ DateTime (sprintf ('2015-04-%d ' , $ i ), new \ DateTimeZone ('UTC ' ));
655
+ $ date = new DateTime (sprintf ('2015-04-%d ' , $ i ), new DateTimeZone ('UTC ' ));
655
656
656
657
$ relatedDummy = $ this ->buildRelatedDummy ();
657
658
$ relatedDummy ->setName ('RelatedDummy # ' .$ i );
@@ -679,7 +680,7 @@ public function thereAreDummyObjectsWithDummyDateAndRelatedDummy(int $nb)
679
680
public function thereAreDummyObjectsWithDummyDateAndEmbeddedDummy (int $ nb )
680
681
{
681
682
for ($ i = 1 ; $ i <= $ nb ; ++$ i ) {
682
- $ date = new \ DateTime (sprintf ('2015-04-%d ' , $ i ), new \ DateTimeZone ('UTC ' ));
683
+ $ date = new DateTime (sprintf ('2015-04-%d ' , $ i ), new DateTimeZone ('UTC ' ));
683
684
684
685
$ embeddableDummy = $ this ->buildEmbeddableDummy ();
685
686
$ embeddableDummy ->setDummyName ('Embeddable # ' .$ i );
@@ -706,7 +707,7 @@ public function thereAreconvertedDateObjectsWith(int $nb)
706
707
{
707
708
for ($ i = 1 ; $ i <= $ nb ; ++$ i ) {
708
709
$ convertedDate = $ this ->buildConvertedDate ();
709
- $ convertedDate ->nameConverted = new \ DateTime (sprintf ('2015-04-%d ' , $ i ), new \ DateTimeZone ('UTC ' ));
710
+ $ convertedDate ->nameConverted = new DateTime (sprintf ('2015-04-%d ' , $ i ), new DateTimeZone ('UTC ' ));
710
711
711
712
$ this ->manager ->persist ($ convertedDate );
712
713
}
@@ -792,7 +793,7 @@ public function thereAreDummyObjectsWithDummyBoolean(int $nb, string $bool)
792
793
$ bool = false ;
793
794
} else {
794
795
$ expected = ['true ' , 'false ' , '1 ' , '0 ' ];
795
- throw new \ InvalidArgumentException (sprintf ('Invalid boolean value for "%s" property, expected one of ( "%s" ) ' , $ bool , implode ('" | " ' , $ expected )));
796
+ throw new InvalidArgumentException (sprintf ('Invalid boolean value for "%s" property, expected one of ( "%s" ) ' , $ bool , implode ('" | " ' , $ expected )));
796
797
}
797
798
$ descriptions = ['Smart dummy. ' , 'Not so smart dummy. ' ];
798
799
@@ -820,7 +821,7 @@ public function thereAreDummyObjectsWithEmbeddedDummyBoolean(int $nb, string $bo
820
821
$ bool = false ;
821
822
} else {
822
823
$ expected = ['true ' , 'false ' , '1 ' , '0 ' ];
823
- throw new \ InvalidArgumentException (sprintf ('Invalid boolean value for "%s" property, expected one of ( "%s" ) ' , $ bool , implode ('" | " ' , $ expected )));
824
+ throw new InvalidArgumentException (sprintf ('Invalid boolean value for "%s" property, expected one of ( "%s" ) ' , $ bool , implode ('" | " ' , $ expected )));
824
825
}
825
826
826
827
for ($ i = 1 ; $ i <= $ nb ; ++$ i ) {
@@ -847,7 +848,7 @@ public function thereAreDummyObjectsWithRelationEmbeddedDummyBoolean(int $nb, st
847
848
$ bool = false ;
848
849
} else {
849
850
$ expected = ['true ' , 'false ' , '1 ' , '0 ' ];
850
- throw new \ InvalidArgumentException (sprintf ('Invalid boolean value for "%s" property, expected one of ( "%s" ) ' , $ bool , implode ('" | " ' , $ expected )));
851
+ throw new InvalidArgumentException (sprintf ('Invalid boolean value for "%s" property, expected one of ( "%s" ) ' , $ bool , implode ('" | " ' , $ expected )));
851
852
}
852
853
853
854
for ($ i = 1 ; $ i <= $ nb ; ++$ i ) {
@@ -977,7 +978,7 @@ public function thereIsAFooEntityWithRelatedBars()
977
978
$ foo = $ this ->buildDummyCar ();
978
979
$ foo ->setName ('mustli ' );
979
980
$ foo ->setCanSell (true );
980
- $ foo ->setAvailableAt (new \ DateTime ());
981
+ $ foo ->setAvailableAt (new DateTime ());
981
982
$ this ->manager ->persist ($ foo );
982
983
983
984
$ bar1 = $ this ->buildDummyCarColor ();
@@ -1078,7 +1079,7 @@ public function thePasswordForUserShouldBeHashed(string $password, string $user)
1078
1079
{
1079
1080
$ user = $ this ->doctrine ->getRepository ($ this ->isOrm () ? User::class : UserDocument::class)->find ($ user );
1080
1081
if (!$ this ->passwordEncoder ->isPasswordValid ($ user , $ password )) {
1081
- throw new \ Exception ('User password mismatch ' );
1082
+ throw new Exception ('User password mismatch ' );
1082
1083
}
1083
1084
}
1084
1085
@@ -1143,7 +1144,7 @@ public function createPeopleWithPets()
1143
1144
public function thereAreDummyDateObjectsWithDummyDate (int $ nb )
1144
1145
{
1145
1146
for ($ i = 1 ; $ i <= $ nb ; ++$ i ) {
1146
- $ date = new \ DateTime (sprintf ('2015-04-%d ' , $ i ), new \ DateTimeZone ('UTC ' ));
1147
+ $ date = new DateTime (sprintf ('2015-04-%d ' , $ i ), new DateTimeZone ('UTC ' ));
1147
1148
1148
1149
$ dummy = $ this ->buildDummyDate ();
1149
1150
$ dummy ->dummyDate = $ date ;
@@ -1161,7 +1162,7 @@ public function thereAreDummyDateObjectsWithDummyDate(int $nb)
1161
1162
public function thereAreDummyDateObjectsWithNullableDateIncludeNullAfter (int $ nb )
1162
1163
{
1163
1164
for ($ i = 1 ; $ i <= $ nb ; ++$ i ) {
1164
- $ date = new \ DateTime (sprintf ('2015-04-%d ' , $ i ), new \ DateTimeZone ('UTC ' ));
1165
+ $ date = new DateTime (sprintf ('2015-04-%d ' , $ i ), new DateTimeZone ('UTC ' ));
1165
1166
1166
1167
$ dummy = $ this ->buildDummyDate ();
1167
1168
$ dummy ->dummyDate = $ date ;
@@ -1180,7 +1181,7 @@ public function thereAreDummyDateObjectsWithNullableDateIncludeNullAfter(int $nb
1180
1181
public function thereAreDummyDateObjectsWithNullableDateIncludeNullBefore (int $ nb )
1181
1182
{
1182
1183
for ($ i = 1 ; $ i <= $ nb ; ++$ i ) {
1183
- $ date = new \ DateTime (sprintf ('2015-04-%d ' , $ i ), new \ DateTimeZone ('UTC ' ));
1184
+ $ date = new DateTime (sprintf ('2015-04-%d ' , $ i ), new DateTimeZone ('UTC ' ));
1184
1185
1185
1186
$ dummy = $ this ->buildDummyDate ();
1186
1187
$ dummy ->dummyDate = $ date ;
@@ -1199,7 +1200,7 @@ public function thereAreDummyDateObjectsWithNullableDateIncludeNullBefore(int $n
1199
1200
public function thereAreDummyDateObjectsWithNullableDateIncludeNullBeforeAndAfter (int $ nb )
1200
1201
{
1201
1202
for ($ i = 1 ; $ i <= $ nb ; ++$ i ) {
1202
- $ date = new \ DateTime (sprintf ('2015-04-%d ' , $ i ), new \ DateTimeZone ('UTC ' ));
1203
+ $ date = new DateTime (sprintf ('2015-04-%d ' , $ i ), new DateTimeZone ('UTC ' ));
1203
1204
1204
1205
$ dummy = $ this ->buildDummyDate ();
1205
1206
$ dummy ->dummyDate = $ date ;
@@ -1217,7 +1218,7 @@ public function thereAreDummyDateObjectsWithNullableDateIncludeNullBeforeAndAfte
1217
1218
public function thereAreDummyImmutableDateObjectsWithDummyDate (int $ nb )
1218
1219
{
1219
1220
for ($ i = 1 ; $ i <= $ nb ; ++$ i ) {
1220
- $ date = new \ DateTimeImmutable (sprintf ('2015-04-%d ' , $ i ), new \ DateTimeZone ('UTC ' ));
1221
+ $ date = new DateTimeImmutable (sprintf ('2015-04-%d ' , $ i ), new DateTimeZone ('UTC ' ));
1221
1222
$ dummy = new DummyImmutableDate ();
1222
1223
$ dummy ->dummyDate = $ date ;
1223
1224
@@ -1393,6 +1394,19 @@ public function thereIsADummyDtoOutputSameClass()
1393
1394
$ this ->manager ->clear ();
1394
1395
}
1395
1396
1397
+ /**
1398
+ * @Given there is a DummyDtoOutputFallbackToSameClass
1399
+ */
1400
+ public function thereIsADummyDtoOutputFallbackToSameClass ()
1401
+ {
1402
+ $ dto = new DummyDtoOutputFallbackToSameClass ();
1403
+ $ dto ->lorem = 'test ' ;
1404
+ $ dto ->ipsum = '1 ' ;
1405
+ $ this ->manager ->persist ($ dto );
1406
+ $ this ->manager ->flush ();
1407
+ $ this ->manager ->clear ();
1408
+ }
1409
+
1396
1410
/**
1397
1411
* @Given there is an order with same customer and recipient
1398
1412
*/
0 commit comments