From d0ccfc732af22eea0d9436fe3ab61d90c3e1fb67 Mon Sep 17 00:00:00 2001 From: gmorel Date: Mon, 25 Nov 2013 22:58:19 +0100 Subject: [PATCH] Coupon : Add unit test for coupon removing X Amount & X Percent --- .../Condition/ConditionOrganizerTest.php | 53 ------------------- .../MatchForTotalAmountTest.php | 6 +-- .../Tests/Coupon/Type/RemoveXAmountTest.php | 2 + .../Tests/Coupon/Type/RemoveXPercentTest.php | 13 +---- 4 files changed, 7 insertions(+), 67 deletions(-) delete mode 100644 core/lib/Thelia/Tests/Condition/ConditionOrganizerTest.php diff --git a/core/lib/Thelia/Tests/Condition/ConditionOrganizerTest.php b/core/lib/Thelia/Tests/Condition/ConditionOrganizerTest.php deleted file mode 100644 index 0591df0ab..000000000 --- a/core/lib/Thelia/Tests/Condition/ConditionOrganizerTest.php +++ /dev/null @@ -1,53 +0,0 @@ -. */ -/* */ -/**********************************************************************************/ - -namespace Thelia\Coupon; -use Thelia\Condition\ConditionOrganizer; - -/** - * Created by JetBrains PhpStorm. - * Date: 8/19/13 - * Time: 3:24 PM - * - * Unit Test ConditionOrganizer Class - * Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2013-11-17 at 18:59:24. - * - * @package Condition - * @author Guillaume MOREL - * - */ -class ConditionOrganizerTest extends \PHPUnit_Framework_TestCase -{ - - /** - * @covers Thelia\Coupon\RuleOrganizer::organize - * @todo Implement testOrganize(). - */ - public function testOrganize() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php b/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php index 0390536c5..d28bf198d 100644 --- a/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php +++ b/core/lib/Thelia/Tests/Condition/Implementation/MatchForTotalAmountTest.php @@ -605,7 +605,7 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase /** * Check unknown currency * - * @covers Thelia\Condition\ConditionAbstract::isCurrencyValid + * @covers Thelia\Condition\Implementation\ConditionAbstract::isCurrencyValid * @expectedException \Thelia\Exception\InvalidConditionValueException * */ @@ -672,7 +672,7 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase /** * Check invalid currency * - * @covers Thelia\Condition\ConditionAbstract::isPriceValid + * @covers Thelia\Condition\Implementation\ConditionAbstract::isPriceValid * @expectedException \Thelia\Exception\InvalidConditionValueException * */ @@ -739,7 +739,7 @@ class MatchForTotalAmountTest extends \PHPUnit_Framework_TestCase /** * Check invalid currency * - * @covers Thelia\Condition\ConditionAbstract::isPriceValid + * @covers Thelia\Condition\Implementation\ConditionAbstract::isPriceValid * @expectedException \Thelia\Exception\InvalidConditionValueException * */ diff --git a/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php b/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php index ce298c97a..41971d4a6 100644 --- a/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php +++ b/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php @@ -169,6 +169,8 @@ class RemoveXAmountTest extends \PHPUnit_Framework_TestCase $this->assertEquals(254, $coupon->getMaxUsage()); $this->assertEquals($date, $coupon->getExpirationDate()); + + $this->assertEquals(10.00, $coupon->exec()); } /** diff --git a/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php b/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php index 7b8e6db91..475e46aba 100644 --- a/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php +++ b/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php @@ -101,6 +101,7 @@ class RemoveXPercentTest extends \PHPUnit_Framework_TestCase /** * @covers Thelia\Coupon\Type\RemoveXPercent::set + * @covers Thelia\Coupon\Type\RemoveXPercent::exec */ public function testSet() { @@ -158,18 +159,8 @@ class RemoveXPercentTest extends \PHPUnit_Framework_TestCase $this->assertEquals(254, $coupon->getMaxUsage()); $this->assertEquals($date, $coupon->getExpirationDate()); - } - /** - * @covers Thelia\Coupon\Type\RemoveXPercent::exec - * @todo Implement testExec(). - */ - public function testExec() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); + $this->assertEquals(40.00, $coupon->exec()); } /**