Skip to content

Commit

Permalink
fix a few failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wernerkrauss committed Feb 20, 2024
1 parent d7c11f9 commit 5ad7688
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Model/PartialUseDiscount.php
Original file line number Diff line number Diff line change
@@ -92,7 +92,7 @@ public function validate()
//prevent vital things from changing
foreach (self::$defaults as $field => $value) {
if ($this->isChanged($field)) {
$result->error("$field should not be changed for partial use discounts.");
$result->addError("$field should not be changed for partial use discounts.");
}
}

4 changes: 2 additions & 2 deletions tests/GiftVoucherTest.php
Original file line number Diff line number Diff line change
@@ -17,10 +17,10 @@ public function setUp(): void
parent::setUp();

$this->variable = $this->objFromFixture(GiftVoucherProduct::class, 'variable');
$this->variable->publish('Stage', 'Live');
$this->variable->copyVersionToStage('Stage', 'Live');

$this->fixed10 = $this->objFromFixture(GiftVoucherProduct::class, '10fixed');
$this->fixed10->publish('Stage', 'Live');
$this->fixed10->copyVersionToStage('Stage', 'Live');
}

public function testCusomisableVoucher()
6 changes: 3 additions & 3 deletions tests/OrderCouponTest.php
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ public function setUp(): void
parent::setUp();
ShopTest::setConfiguration();

Config::inst()->merge(OrderCoupon::class, 'minimum_code_length', null);
Config::inst()->set(OrderCoupon::class, 'minimum_code_length', null);

$this->socks = $this->objFromFixture(Product::class, 'socks');
$this->socks->publishRecursive();
@@ -38,7 +38,7 @@ public function setUp(): void

public function testMinimumLengthCode()
{
Config::inst()->update(OrderCoupon::class, 'minimum_code_length', 8);
Config::inst()->set(OrderCoupon::class, 'minimum_code_length', 8);
$coupon = new OrderCoupon();
$coupon->Code = '1234567';
$result = $coupon->validate();
@@ -52,7 +52,7 @@ public function testMinimumLengthCode()
$result = $coupon->validate();
self::assertNotContains('INVALIDMINLENGTH', $result->getMessages());

Config::inst()->update(OrderCoupon::class, 'minimum_code_length', null);
Config::inst()->set(OrderCoupon::class, 'minimum_code_length', null);

$coupon = new OrderCoupon(['Code' => '1']);
$result = $coupon->validate();
2 changes: 1 addition & 1 deletion tests/ProductTypeDiscountConstraintTest.php
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ public function setUp(): void
$this->mp3player->publishRecursive();

$this->voucher = $this->objFromFixture(GiftVoucherProduct::class, '10fixed');
$this->voucher->publish('Stage', 'Live');
$this->voucher->copyVersionToStage('Stage', 'Live');
}

public function testProducts()

0 comments on commit 5ad7688

Please sign in to comment.