@@ -287,6 +287,7 @@ public function testPrices()
287287 )
288288 )
289289 ;
290+ $ request ->currency ('EUR ' );
290291 $ response = $ request ->executeWithClient ($ this ->getClient ());
291292 $ result = $ request ->mapResponse ($ response );
292293 $ this ->deleteRequest ->setVersion ($ result ->getVersion ());
@@ -298,6 +299,13 @@ public function testPrices()
298299 $ price ->getValue ()->getCentAmount (),
299300 $ variant ->getPrices ()->current ()->getValue ()->getCentAmount ()
300301 );
302+
303+ $ this ->assertEmpty ($ variant ->getPrice ()->getCountry ());
304+ $ this ->assertEmpty ($ variant ->getPrice ()->getChannel ());
305+ $ this ->assertEmpty ($ variant ->getPrice ()->getCustomerGroup ());
306+ $ this ->assertSame ('EUR ' , $ variant ->getPrice ()->getValue ()->getCurrencyCode ());
307+ $ this ->assertSame (100 , $ variant ->getPrice ()->getValue ()->getCentAmount ());
308+
301309 $ this ->assertNotSame ($ product ->getVersion (), $ result ->getVersion ());
302310 $ product = $ result ;
303311
@@ -1168,6 +1176,63 @@ public function testReferenceExpansion()
11681176 array_pop ($ this ->cleanupRequests );
11691177 }
11701178
1179+ public function testPriceSelectCreateUpdateDelete ()
1180+ {
1181+ $ draft = $ this ->getDraft ('update-reference-expansion ' );
1182+ $ draft ->setMasterVariant (
1183+ ProductVariantDraft::of ()->setSku ('sku ' . uniqid ())
1184+ ->setPrices (
1185+ PriceDraftCollection::of ()->add (
1186+ PriceDraft::ofMoney (Money::ofCurrencyAndAmount ('EUR ' , 100 ))
1187+ )
1188+ )
1189+ );
1190+
1191+ $ request = ProductCreateRequest::ofDraft ($ draft );
1192+ $ request ->currency ('EUR ' );
1193+ $ response = $ request ->executeWithClient ($ this ->getClient ());
1194+ $ product = $ request ->mapResponse ($ response );
1195+
1196+ $ this ->cleanupRequests [] = $ this ->deleteRequest = ProductDeleteRequest::ofIdAndVersion (
1197+ $ product ->getId (),
1198+ $ product ->getVersion ()
1199+ );
1200+
1201+ $ variant = $ product ->getMasterData ()->getStaged ()->getMasterVariant ();
1202+ $ this ->assertEmpty ($ variant ->getPrice ()->getCountry ());
1203+ $ this ->assertEmpty ($ variant ->getPrice ()->getChannel ());
1204+ $ this ->assertEmpty ($ variant ->getPrice ()->getCustomerGroup ());
1205+ $ this ->assertSame ('EUR ' , $ variant ->getPrice ()->getValue ()->getCurrencyCode ());
1206+ $ this ->assertSame (100 , $ variant ->getPrice ()->getValue ()->getCentAmount ());
1207+
1208+ $ request = ProductUpdateRequest::ofIdAndVersion ($ product ->getId (), $ product ->getVersion ());
1209+ $ request ->currency ('EUR ' );
1210+ $ response = $ request ->executeWithClient ($ this ->getClient ());
1211+ $ product = $ request ->mapResponse ($ response );
1212+ $ this ->deleteRequest ->setVersion ($ product ->getVersion ());
1213+
1214+ $ variant = $ product ->getMasterData ()->getStaged ()->getMasterVariant ();
1215+ $ this ->assertEmpty ($ variant ->getPrice ()->getCountry ());
1216+ $ this ->assertEmpty ($ variant ->getPrice ()->getChannel ());
1217+ $ this ->assertEmpty ($ variant ->getPrice ()->getCustomerGroup ());
1218+ $ this ->assertSame ('EUR ' , $ variant ->getPrice ()->getValue ()->getCurrencyCode ());
1219+ $ this ->assertSame (100 , $ variant ->getPrice ()->getValue ()->getCentAmount ());
1220+
1221+ $ request = ProductDeleteRequest::ofIdAndVersion ($ product ->getId (), $ product ->getVersion ());
1222+ $ request ->currency ('EUR ' );
1223+ $ response = $ request ->executeWithClient ($ this ->getClient ());
1224+ $ product = $ request ->mapResponse ($ response );
1225+
1226+ $ variant = $ product ->getMasterData ()->getStaged ()->getMasterVariant ();
1227+ $ this ->assertEmpty ($ variant ->getPrice ()->getCountry ());
1228+ $ this ->assertEmpty ($ variant ->getPrice ()->getChannel ());
1229+ $ this ->assertEmpty ($ variant ->getPrice ()->getCustomerGroup ());
1230+ $ this ->assertSame ('EUR ' , $ variant ->getPrice ()->getValue ()->getCurrencyCode ());
1231+ $ this ->assertSame (100 , $ variant ->getPrice ()->getValue ()->getCentAmount ());
1232+
1233+ array_pop ($ this ->cleanupRequests );
1234+ }
1235+
11711236 /**
11721237 * @return ProductDraft
11731238 */
0 commit comments