-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cdcc82c
commit 4369ebe
Showing
5 changed files
with
145 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: darryl | ||
* Date: 3/18/2015 | ||
* Time: 6:17 PM | ||
*/ | ||
|
||
use Darryldecode\Cart\Cart; | ||
use Mockery as m; | ||
|
||
require_once __DIR__.'/helpers/SessionMock.php'; | ||
|
||
class ItemTest extends PHPUnit_Framework_TestCase | ||
{ | ||
|
||
/** | ||
* @var Darryldecode\Cart\Cart | ||
*/ | ||
protected $cart; | ||
|
||
public function setUp() | ||
{ | ||
$events = m::mock('Illuminate\Contracts\Events\Dispatcher'); | ||
$events->shouldReceive('fire'); | ||
|
||
$this->cart = new Cart( | ||
new SessionMock(), | ||
$events, | ||
'shopping', | ||
'SAMPLESESSIONKEY' | ||
); | ||
} | ||
|
||
public function tearDown() | ||
{ | ||
m::close(); | ||
} | ||
|
||
public function test_item_get_sum_price_using_property() | ||
{ | ||
$this->cart->add(455, 'Sample Item', 100.99, 2, array()); | ||
|
||
$item = $this->cart->get(455); | ||
|
||
$this->assertEquals(201.98, $item->getPriceSum(), 'Item summed price should be 201.98'); | ||
} | ||
|
||
public function test_item_get_sum_price_using_array_style() | ||
{ | ||
$this->cart->add(455, 'Sample Item', 100.99, 2, array()); | ||
|
||
$item = $this->cart->get(455); | ||
|
||
$this->assertEquals(201.98, $item->getPriceSum(), 'Item summed price should be 201.98'); | ||
} | ||
} |