Refactor shipping_preference

Extract its determination to a separate class, also remove useless CartRepository and use single PU to avoid confusion.
This commit is contained in:
Alex P 2022-07-05 14:25:55 +03:00
parent 67cdf9be8e
commit fff2570124
20 changed files with 245 additions and 264 deletions

View file

@ -952,7 +952,7 @@ class OrderEndpointTest extends TestCase
->expects('email_address')
->andReturn('');
$result = $testee->create([$purchaseUnit], $payer);
$result = $testee->create([$purchaseUnit], ApplicationContext::SHIPPING_PREFERENCE_NO_SHIPPING, $payer);
$this->assertEquals($expectedOrder, $result);
}
@ -1049,7 +1049,7 @@ class OrderEndpointTest extends TestCase
$payerName = Mockery::mock(PayerName::class);
$payer->expects('name')->andReturn($payerName);
$payer->expects('to_array')->andReturn(['payer']);
$result = $testee->create([$purchaseUnit], $payer);
$result = $testee->create([$purchaseUnit], ApplicationContext::SHIPPING_PREFERENCE_GET_FROM_FILE, $payer);
$this->assertEquals($expectedOrder, $result);
}
@ -1141,7 +1141,7 @@ class OrderEndpointTest extends TestCase
$payerName = Mockery::mock(PayerName::class);
$payer->expects('name')->andReturn($payerName);
$payer->expects('to_array')->andReturn(['payer']);
$testee->create([$purchaseUnit], $payer);
$testee->create([$purchaseUnit], ApplicationContext::SHIPPING_PREFERENCE_NO_SHIPPING, $payer);
}
public function testCreateForPurchaseUnitsIsNot201()
@ -1232,6 +1232,6 @@ class OrderEndpointTest extends TestCase
$payerName = Mockery::mock(PayerName::class);
$payer->expects('name')->andReturn($payerName);
$payer->expects('to_array')->andReturn(['payer']);
$testee->create([$purchaseUnit], $payer);
$testee->create([$purchaseUnit], ApplicationContext::SHIPPING_PREFERENCE_GET_FROM_FILE, $payer);
}
}