@@ -1052,6 +1052,52 @@ public function testPublish()
10521052 $ this ->assertNotSame ($ product ->getVersion (), $ result ->getVersion ());
10531053 }
10541054
1055+ public function testPublishPrices ()
1056+ {
1057+ $ draft = $ this ->getDraft ('publish-prices ' );
1058+ $ draft
1059+ ->setMasterVariant (
1060+ ProductVariantDraft::of ()->setSku ('sku- ' . $ this ->getTestRun ())
1061+ ->setPrices (
1062+ PriceDraftCollection::of ()
1063+ ->add (PriceDraft::ofMoney (Money::ofCurrencyAndAmount ('EUR ' , 100 )))
1064+ )
1065+ )->setPublish (true );
1066+ $ product = $ this ->createProduct ($ draft );
1067+ $ request = ProductUpdateRequest::ofIdAndVersion ($ product ->getId (), $ product ->getVersion ())
1068+ ->addAction (ProductSetDescriptionAction::of ()->setDescription (LocalizedString::ofLangAndText ('en ' , $ this ->getTestRun ())))
1069+ ->addAction (
1070+ ProductSetPricesAction::of ()->setSku ('sku- ' . $ this ->getTestRun ())
1071+ ->setPrices (PriceDraftCollection::of ()
1072+ ->add (PriceDraft::ofMoney (Money::ofCurrencyAndAmount ('EUR ' , 200 )))
1073+ )
1074+ )
1075+ ->addAction (ProductPublishAction::of ()->setScope (ProductPublishAction::PRICES ))
1076+ ;
1077+ $ response = $ request ->executeWithClient ($ this ->getClient ());
1078+ $ result = $ request ->mapResponse ($ response );
1079+ $ this ->deleteRequest ->setVersion ($ result ->getVersion ());
1080+
1081+ $ this ->assertInstanceOf (Product::class, $ result );
1082+ $ this ->assertTrue ($ result ->getMasterData ()->getHasStagedChanges ());
1083+ $ this ->assertSame (
1084+ 200 ,
1085+ $ result ->getMasterData ()->getCurrent ()->getMasterVariant ()->getPrices ()->current ()->getValue ()->getCentAmount ()
1086+ );
1087+ $ this ->assertNotSame ($ product ->getVersion (), $ result ->getVersion ());
1088+ $ product = $ result ;
1089+
1090+ $ request = ProductUpdateRequest::ofIdAndVersion ($ product ->getId (), $ product ->getVersion ())
1091+ ->addAction (ProductPublishAction::of ()->setScope (ProductPublishAction::ALL ))
1092+ ;
1093+ $ response = $ request ->executeWithClient ($ this ->getClient ());
1094+ $ result = $ request ->mapResponse ($ response );
1095+ $ this ->deleteRequest ->setVersion ($ result ->getVersion ());
1096+
1097+ $ this ->assertInstanceOf (Product::class, $ result );
1098+ $ this ->assertFalse ($ result ->getMasterData ()->getHasStagedChanges ());
1099+ }
1100+
10551101 public function testTransitionStates ()
10561102 {
10571103 $ draft = $ this ->getDraft ('publish ' );
0 commit comments