Skip to content

Commit 6b172fa

Browse files
authored
Merge pull request #172 from darryldecode/fix-issue#170
fix issue #170
2 parents 2f84a00 + 81b3cb3 commit 6b172fa

8 files changed

+27
-27
lines changed

src/Darryldecode/Cart/Cart.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,6 @@ public function setThousandsSep($thousands_sep)
831831
*/
832832
protected function fireEvent($name, $value = [])
833833
{
834-
return $this->events->fire($this->getInstanceName() . '.' . $name, array_values([$value, $this]));
834+
return $this->events->dispatch($this->getInstanceName() . '.' . $name, array_values([$value, $this]));
835835
}
836836
}

tests/CartConditionsTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CartConditionTest extends PHPUnit\Framework\TestCase {
2222
public function setUp()
2323
{
2424
$events = m::mock('Illuminate\Contracts\Events\Dispatcher');
25-
$events->shouldReceive('fire');
25+
$events->shouldReceive('dispatch');
2626

2727
$this->cart = new Cart(
2828
new SessionMock(),

tests/CartTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class CartTest extends PHPUnit\Framework\TestCase {
2121
public function setUp()
2222
{
2323
$events = m::mock('Illuminate\Contracts\Events\Dispatcher');
24-
$events->shouldReceive('fire');
24+
$events->shouldReceive('dispatch');
2525

2626
$this->cart = new Cart(
2727
new SessionMock(),

tests/CartTestEvents.php

+20-20
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function tearDown()
2727
public function test_event_cart_created()
2828
{
2929
$events = m::mock('Illuminate\Contracts\Events\Dispatcher');
30-
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME.'.created', m::type('array'));
30+
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME.'.created', m::type('array'));
3131

3232
$cart = new Cart(
3333
new SessionMock(),
@@ -43,9 +43,9 @@ public function test_event_cart_created()
4343
public function test_event_cart_adding()
4444
{
4545
$events = m::mock('Illuminate\Events\Dispatcher');
46-
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME.'.created', m::type('array'));
47-
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME.'.adding', m::type('array'));
48-
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME.'.added', m::type('array'));
46+
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME.'.created', m::type('array'));
47+
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME.'.adding', m::type('array'));
48+
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME.'.added', m::type('array'));
4949

5050
$cart = new Cart(
5151
new SessionMock(),
@@ -63,9 +63,9 @@ public function test_event_cart_adding()
6363
public function test_event_cart_adding_multiple_times()
6464
{
6565
$events = m::mock('Illuminate\Events\Dispatcher');
66-
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME.'.created', m::type('array'));
67-
$events->shouldReceive('fire')->times(2)->with(self::CART_INSTANCE_NAME.'.adding', m::type('array'));
68-
$events->shouldReceive('fire')->times(2)->with(self::CART_INSTANCE_NAME.'.added', m::type('array'));
66+
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME.'.created', m::type('array'));
67+
$events->shouldReceive('dispatch')->times(2)->with(self::CART_INSTANCE_NAME.'.adding', m::type('array'));
68+
$events->shouldReceive('dispatch')->times(2)->with(self::CART_INSTANCE_NAME.'.added', m::type('array'));
6969

7070
$cart = new Cart(
7171
new SessionMock(),
@@ -84,9 +84,9 @@ public function test_event_cart_adding_multiple_times()
8484
public function test_event_cart_adding_multiple_times_scenario_two()
8585
{
8686
$events = m::mock('Illuminate\Events\Dispatcher');
87-
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME.'.created', m::type('array'));
88-
$events->shouldReceive('fire')->times(3)->with(self::CART_INSTANCE_NAME.'.adding', m::type('array'));
89-
$events->shouldReceive('fire')->times(3)->with(self::CART_INSTANCE_NAME.'.added', m::type('array'));
87+
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME.'.created', m::type('array'));
88+
$events->shouldReceive('dispatch')->times(3)->with(self::CART_INSTANCE_NAME.'.adding', m::type('array'));
89+
$events->shouldReceive('dispatch')->times(3)->with(self::CART_INSTANCE_NAME.'.added', m::type('array'));
9090

9191
$items = array(
9292
array(
@@ -128,11 +128,11 @@ public function test_event_cart_adding_multiple_times_scenario_two()
128128
public function test_event_cart_remove_item()
129129
{
130130
$events = m::mock('Illuminate\Events\Dispatcher');
131-
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME.'.created', m::type('array'));
132-
$events->shouldReceive('fire')->times(3)->with(self::CART_INSTANCE_NAME.'.adding', m::type('array'));
133-
$events->shouldReceive('fire')->times(3)->with(self::CART_INSTANCE_NAME.'.added', m::type('array'));
134-
$events->shouldReceive('fire')->times(1)->with(self::CART_INSTANCE_NAME.'.removing', m::type('array'));
135-
$events->shouldReceive('fire')->times(1)->with(self::CART_INSTANCE_NAME.'.removed', m::type('array'));
131+
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME.'.created', m::type('array'));
132+
$events->shouldReceive('dispatch')->times(3)->with(self::CART_INSTANCE_NAME.'.adding', m::type('array'));
133+
$events->shouldReceive('dispatch')->times(3)->with(self::CART_INSTANCE_NAME.'.added', m::type('array'));
134+
$events->shouldReceive('dispatch')->times(1)->with(self::CART_INSTANCE_NAME.'.removing', m::type('array'));
135+
$events->shouldReceive('dispatch')->times(1)->with(self::CART_INSTANCE_NAME.'.removed', m::type('array'));
136136

137137
$items = array(
138138
array(
@@ -176,11 +176,11 @@ public function test_event_cart_remove_item()
176176
public function test_event_cart_clear()
177177
{
178178
$events = m::mock('Illuminate\Events\Dispatcher');
179-
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME.'.created', m::type('array'));
180-
$events->shouldReceive('fire')->times(3)->with(self::CART_INSTANCE_NAME.'.adding', m::type('array'));
181-
$events->shouldReceive('fire')->times(3)->with(self::CART_INSTANCE_NAME.'.added', m::type('array'));
182-
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME.'.clearing', m::type('array'));
183-
$events->shouldReceive('fire')->once()->with(self::CART_INSTANCE_NAME.'.cleared', m::type('array'));
179+
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME.'.created', m::type('array'));
180+
$events->shouldReceive('dispatch')->times(3)->with(self::CART_INSTANCE_NAME.'.adding', m::type('array'));
181+
$events->shouldReceive('dispatch')->times(3)->with(self::CART_INSTANCE_NAME.'.added', m::type('array'));
182+
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME.'.clearing', m::type('array'));
183+
$events->shouldReceive('dispatch')->once()->with(self::CART_INSTANCE_NAME.'.cleared', m::type('array'));
184184

185185
$items = array(
186186
array(

tests/CartTestMultipleInstances.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CartTestMultipleInstances extends PHPUnit\Framework\TestCase {
2626
public function setUp()
2727
{
2828
$events = m::mock('Illuminate\Contracts\Events\Dispatcher');
29-
$events->shouldReceive('fire');
29+
$events->shouldReceive('dispatch');
3030

3131
$this->cart1 = new Cart(
3232
new SessionMock(),

tests/CartTestOtherFormat.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class CartTestOtherFormat extends PHPUnit\Framework\TestCase {
2121
public function setUp()
2222
{
2323
$events = m::mock('Illuminate\Contracts\Events\Dispatcher');
24-
$events->shouldReceive('fire');
24+
$events->shouldReceive('dispatch');
2525

2626
$this->cart = new Cart(
2727
new SessionMock(),

tests/ItemTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ItemTest extends PHPUnit\Framework\TestCase
2323
public function setUp()
2424
{
2525
$events = m::mock('Illuminate\Contracts\Events\Dispatcher');
26-
$events->shouldReceive('fire');
26+
$events->shouldReceive('dispatch');
2727

2828
$this->cart = new Cart(
2929
new SessionMock(),

tests/ItemTestOtherFormat.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ItemTestOtherFormat extends PHPUnit\Framework\TestCase
2222
public function setUp()
2323
{
2424
$events = m::mock('Illuminate\Contracts\Events\Dispatcher');
25-
$events->shouldReceive('fire');
25+
$events->shouldReceive('dispatch');
2626

2727
$this->cart = new Cart(
2828
new SessionMock(),

0 commit comments

Comments
 (0)