Skip to content

Commit

Permalink
Moved CartItem classes into appropriate folder
Browse files Browse the repository at this point in the history
  • Loading branch information
mattias-persson committed Mar 7, 2019
1 parent ab25dcd commit 731bc4b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
7 changes: 3 additions & 4 deletions src/Cart/Cart.php
Expand Up @@ -2,7 +2,6 @@

namespace Happypixels\Shopr\Cart;

use Happypixels\Shopr\CartItem;
use Illuminate\Support\Collection;
use Happypixels\Shopr\Models\Order;
use Illuminate\Support\Facades\Event;
Expand Down Expand Up @@ -290,7 +289,7 @@ public function convertToOrder($gateway, $data = [])
* @param array $options
* @param array $subItems
* @param float|null $price
* @return Happypixels\Shopr\CartItem
* @return Happypixels\Shopr\Cart\CartItem
*/
public function addItem($shoppableType, $shoppableId, $quantity = 1, $options = [], $subItems = [], $price = null) : CartItem
{
Expand Down Expand Up @@ -333,7 +332,7 @@ public function addItem($shoppableType, $shoppableId, $quantity = 1, $options =
*
* @param string $id
* @param array $data
* @return Happypixels\Shopr\CartItem
* @return Happypixels\Shopr\Cart\CartItem
*/
public function updateItem($id, $data)
{
Expand Down Expand Up @@ -380,7 +379,7 @@ public function updateItem($id, $data)
* Removes a single item from the cart.
*
* @param string $id
* @return Happypixels\Shopr\CartItem
* @return Happypixels\Shopr\Cart\CartItem
*/
public function removeItem($id)
{
Expand Down
2 changes: 1 addition & 1 deletion src/CartItem.php → src/Cart/CartItem.php
@@ -1,6 +1,6 @@
<?php

namespace Happypixels\Shopr;
namespace Happypixels\Shopr\Cart;

use Happypixels\Shopr\Money\Formatter;

Expand Down
2 changes: 1 addition & 1 deletion src/CartSubItem.php → src/Cart/CartSubItem.php
@@ -1,6 +1,6 @@
<?php

namespace Happypixels\Shopr;
namespace Happypixels\Shopr\Cart;

use Happypixels\Shopr\Money\Formatter;

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Cart/AddCartItemUnitTest.php
Expand Up @@ -2,8 +2,8 @@

namespace Happypixels\Shopr\Tests\Unit\Cart;

use Happypixels\Shopr\CartItem;
use Happypixels\Shopr\Cart\Cart;
use Happypixels\Shopr\Cart\CartItem;
use Happypixels\Shopr\Tests\TestCase;
use Illuminate\Support\Facades\Event;
use Happypixels\Shopr\Models\DiscountCoupon;
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Cart/CartUnitTest.php
Expand Up @@ -108,7 +108,7 @@ public function items_are_a_collection_of_cart_items()
$cart->addItem(get_class($model), 1);

$this->assertEquals('Illuminate\Support\Collection', get_class($cart->items()));
$this->assertEquals('Happypixels\Shopr\CartItem', get_class($cart->items()->first()));
$this->assertEquals('Happypixels\Shopr\Cart\CartItem', get_class($cart->items()->first()));
}

/** @test */
Expand All @@ -132,7 +132,7 @@ public function discounts_are_a_collection_of_cart_items_with_only_added_discoun
$cart->addDiscount($discount);

$this->assertEquals('Illuminate\Support\Collection', get_class($cart->discounts()));
$this->assertEquals('Happypixels\Shopr\CartItem', get_class($cart->discounts()->first()));
$this->assertEquals('Happypixels\Shopr\Cart\CartItem', get_class($cart->discounts()->first()));
$this->assertEquals(1, $cart->discounts()->count());
$this->assertEquals($discount->code, $cart->discounts()->first()->shoppable->getTitle());
}
Expand All @@ -150,7 +150,7 @@ public function sub_items_are_a_collection_of_cart_sub_items()
]);

$this->assertEquals('Illuminate\Support\Collection', get_class($cart->items()->first()->subItems));
$this->assertEquals('Happypixels\Shopr\CartSubItem', get_class($cart->items()->first()->subItems->first()));
$this->assertEquals('Happypixels\Shopr\Cart\CartSubItem', get_class($cart->items()->first()->subItems->first()));
}

/** @test */
Expand Down

0 comments on commit 731bc4b

Please sign in to comment.