protected function BuyXGetYTest::assertAdjustmentPrice in Commerce Core 8.2
Asserts that a promotion adjustment has the expected price.
Parameters
\Drupal\commerce_order\Adjustment $adjustment: The adjustment to test.
string $price: The expected price, as a string.
string $currency_code: The expected currency code.
2 calls to BuyXGetYTest::assertAdjustmentPrice()
- BuyXGetYTest::testAutoAddOrderItem in modules/
promotion/ tests/ src/ Kernel/ Plugin/ Commerce/ PromotionOffer/ BuyXGetYTest.php - Tests the 'auto-add' offered item capability.
- BuyXGetYTest::testAutoRemoveOrderItem in modules/
promotion/ tests/ src/ Kernel/ Plugin/ Commerce/ PromotionOffer/ BuyXGetYTest.php - Tests that the auto-added get order item is automatically removed.
File
- modules/
promotion/ tests/ src/ Kernel/ Plugin/ Commerce/ PromotionOffer/ BuyXGetYTest.php, line 764
Class
- BuyXGetYTest
- Tests the "Buy X Get Y" offer.
Namespace
Drupal\Tests\commerce_promotion\Kernel\Plugin\Commerce\PromotionOfferCode
protected function assertAdjustmentPrice(Adjustment $adjustment, $price, $currency_code = 'USD') {
$this
->assertEquals('promotion', $adjustment
->getType());
$this
->assertEquals(new Price($price, $currency_code), $adjustment
->getAmount());
$this
->assertEquals($this->promotion
->id(), $adjustment
->getSourceId());
}