Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
make methods public
simplify a calculation
  • Loading branch information
wernerkrauss committed Mar 4, 2019
1 parent 1b19ffc commit 3417265
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Extensions/Constraints/GroupDiscountConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function filter(DataList $list)
{
$groupids = [0];
if ($member = $this->getMember()) {
$groupids = $groupids + $member->Groups()
$groupids += $member->Groups()
->map('ID', 'ID')
->toArray();
}
Expand Down
12 changes: 6 additions & 6 deletions tests/CalculatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function testZeroOrderDiscount()
$this->markTestIncomplete('Add assertions');
}

function testItemLevelPercentAndAmountDiscounts()
public function testItemLevelPercentAndAmountDiscounts()
{
OrderDiscount::get()->removeAll();
OrderDiscount::create(
Expand Down Expand Up @@ -171,7 +171,7 @@ function testItemLevelPercentAndAmountDiscounts()
);
}

function testCouponAndDiscountItemLevel()
public function testCouponAndDiscountItemLevel()
{
OrderDiscount::create(
[
Expand Down Expand Up @@ -208,7 +208,7 @@ function testCouponAndDiscountItemLevel()
//the order subtotal
}

function testItemAndCartLevelAmountDiscounts()
public function testItemAndCartLevelAmountDiscounts()
{
OrderDiscount::create(
[
Expand Down Expand Up @@ -236,7 +236,7 @@ function testItemAndCartLevelAmountDiscounts()
$this->markTestIncomplete('test distribution of amounts');
}

function testCartLevelAmount()
public function testCartLevelAmount()
{
//entire cart
$discount = OrderDiscount::create(
Expand All @@ -258,7 +258,7 @@ function testCartLevelAmount()
$this->assertEquals(25, $calculator->calculate());
}

function testCartLevelPercent()
public function testCartLevelPercent()
{
$discount = OrderDiscount::create(
[
Expand All @@ -284,7 +284,7 @@ function testCartLevelPercent()
$this->assertEquals(205, $calculator->calculate());
}

function testMaxAmount()
public function testMaxAmount()
{
//percent item discounts
$discount = OrderDiscount::create(
Expand Down
2 changes: 1 addition & 1 deletion tests/DiscountReportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DiscountReportTest extends SapphireTest

protected static $fixture_file = 'Discounts.yml';

function testDiscountReport()
public function testDiscountReport()
{
$discount = $this->objFromFixture(OrderDiscount::class, 'used');
$report = new DiscountReport();
Expand Down

0 comments on commit 3417265

Please sign in to comment.