File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Commercetools \UnitTest ;
4+
5+ use Commercetools \Import \Models \Common \MoneyBuilder ;
6+ use Commercetools \Import \Models \Common \TypeKeyReferenceBuilder ;
7+ use Commercetools \Import \Models \Customfields \CustomBuilder ;
8+ use Commercetools \Import \Models \Customfields \FieldContainerModel ;
9+ use Commercetools \Import \Models \Productdrafts \PriceDraftImportBuilder ;
10+ use PHPUnit \Framework \TestCase ;
11+
12+ class ImportPriceDraftTest extends TestCase
13+ {
14+ public function testPriceDraft ()
15+ {
16+ $ priceDraft = PriceDraftImportBuilder::of ()
17+ ->withCustomBuilder (
18+ CustomBuilder::of ()
19+ ->withTypeBuilder (TypeKeyReferenceBuilder::of ()->withKey ("mytypekey " ))
20+ ->withFields (
21+ FieldContainerModel::fromArray (
22+ [
23+ 'foo ' => MoneyBuilder::of ()
24+ ->withCurrencyCode ('EUR ' )
25+ ->withCentAmount (100 )
26+ ->build ()
27+ ]
28+ )
29+ )
30+ )
31+ ;
32+ $ this ->assertJsonStringEqualsJsonString (
33+ '{
34+ "custom": {
35+ "fields": {
36+ "foo": {
37+ "centAmount": 100,
38+ "currencyCode": "EUR",
39+ "type": "centPrecision"
40+ }
41+ },
42+ "type": {
43+ "key": "mytypekey",
44+ "typeId": "type"
45+ }
46+ }
47+ } ' ,
48+ json_encode ($ priceDraft ->build ())
49+ );
50+ }
51+ }
You can’t perform that action at this time.
0 commit comments