50 lines
1.2 KiB
PHP
50 lines
1.2 KiB
PHP
<?php
|
|
|
|
use KupShop\DevelopmentBundle\Util\Tests\CartTestTrait;
|
|
|
|
class CartUnits_FloatSuite extends DatabaseTestCase
|
|
{
|
|
use CartTestTrait;
|
|
|
|
public function getDataSet()
|
|
{
|
|
return $this->getJsonDataSetFromFile();
|
|
}
|
|
|
|
protected function tearDown(): void
|
|
{
|
|
parent::tearDown();
|
|
|
|
Delivery::clearCache();
|
|
}
|
|
|
|
public function testAddItemToCart()
|
|
{
|
|
$this->loginUser(1);
|
|
|
|
$this->updateSQL('products', ['unit' => 2], ['id' => 1]);
|
|
|
|
$this->createCart();
|
|
$this->insertProduct(1, 16, 1.35);
|
|
|
|
$this->createCart();
|
|
$this->assertEquals(1080, $this->cart->totalPriceWithVat->asFloat());
|
|
|
|
$this->checkOrderPriceIsSameAsCart();
|
|
}
|
|
|
|
public function testCorrectSubFromStore()
|
|
{
|
|
$this->loginUser(1);
|
|
$this->updateSQL('products', ['unit' => 2], ['id' => 1]);
|
|
|
|
$this->createCart();
|
|
$this->insertProduct(1, 16, '1,35');
|
|
|
|
$this->checkOrderPriceIsSameAsCart();
|
|
$in_store = sqlQueryBuilder()->select('in_store')->from('products_variations')->where('id = 16')->execute()->fetchColumn();
|
|
|
|
$this->assertEquals(-1.35, $in_store);
|
|
}
|
|
}
|