mirror of
https://github.com/wearepixel/laravel-cart.git
synced 2026-11-14 13:51:44 +00:00
init commit :rocket
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'format_numbers' => false,
|
||||
'decimals' => 2,
|
||||
'dec_point' => '.',
|
||||
'thousands_sep' => ',',
|
||||
];
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'format_numbers' => false,
|
||||
'decimals' => 3,
|
||||
'dec_point' => ',',
|
||||
'thousands_sep' => '.',
|
||||
];
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace Wearepixel\Cart\Tests\Helpers;
|
||||
|
||||
use Illuminate\Contracts\Database\ModelIdentifier;
|
||||
|
||||
class MockProduct extends ModelIdentifier
|
||||
{
|
||||
/**
|
||||
* @var int|string
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
public $price;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
public $weight;
|
||||
|
||||
/**
|
||||
* Product constructor.
|
||||
*
|
||||
* @param int|string $id
|
||||
* @param string $name
|
||||
* @param float $price
|
||||
*/
|
||||
public function __construct($id = 455, $name = 'Sample Item', $price = 100.99, $weight = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->name = $name;
|
||||
$this->price = $price;
|
||||
$this->weight = $weight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the identifier of the item.
|
||||
*
|
||||
* @return int|string
|
||||
*/
|
||||
public function getIdentifier($options = null)
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the description or title of the item.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription($options = null)
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the price of the item.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getPrice($options = null)
|
||||
{
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the price of the item.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getWeight($options = null)
|
||||
{
|
||||
return $this->weight;
|
||||
}
|
||||
|
||||
public function find($id)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Wearepixel\Cart\Tests\Helpers;
|
||||
|
||||
class SessionMock
|
||||
{
|
||||
protected $session = [];
|
||||
|
||||
public function has($key)
|
||||
{
|
||||
return isset($this->session[$key]);
|
||||
}
|
||||
|
||||
public function get($key)
|
||||
{
|
||||
return (isset($this->session[$key])) ? $this->session[$key] : null;
|
||||
}
|
||||
|
||||
public function put($key, $value)
|
||||
{
|
||||
$this->session[$key] = $value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user