mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-20 14:25:09 +00:00
Added test for model using trait
Added readme for CanBeBoughtTrait https://github.com/Crinsane/LaravelShoppingcart/issues/427
This commit is contained in:
45
tests/Fixtures/BuyableProductTrait.php
Normal file
45
tests/Fixtures/BuyableProductTrait.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Gloudemans\Tests\Shoppingcart\Fixtures;
|
||||
|
||||
use Gloudemans\Shoppingcart\Contracts\Buyable;
|
||||
|
||||
class BuyableProductTrait implements Buyable
|
||||
{
|
||||
use \Gloudemans\Shoppingcart\CanBeBought;
|
||||
|
||||
/**
|
||||
* @var int|string
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
private $price;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
private $weight;
|
||||
|
||||
/**
|
||||
* BuyableProduct constructor.
|
||||
*
|
||||
* @param int|string $id
|
||||
* @param string $name
|
||||
* @param float $price
|
||||
*/
|
||||
public function __construct($id = 1, $name = 'Item name', $price = 10.00, $weight = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->name = $name;
|
||||
$this->price = $price;
|
||||
$this->weight = $weight;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user