<?php

namespace KupShop\ProductsChargesBundle\Tests;

use KupShop\DevelopmentBundle\Util\Tests\CartTestTrait;

class OrdersChargesTest extends \DatabaseTestCase
{
    use CartTestTrait;

    public function testOrderWithPercentCharge(): void
    {
        $this->createCart();
        $this->assertEquals(0, $this->cart->totalPricePay->asFloat());
        $this->insertProduct(8);
        $this->recalculateCart();
        $this->assertEquals(4990 * 11, $this->cart->getPurchaseState()->getTotalPrice()->getPriceWithVat()->asFloat());
        $this->assertEquals(4990 * 10, $this->cart->getPurchaseState()->getChargesTotalPrice()->getPriceWithVat()->asFloat());
        $this->assertEquals(4990, $this->cart->getPurchaseState()->getProductsTotalPrice()->getPriceWithVat()->asFloat());
    }

    protected function getDataSet()
    {
        return $this->getJsonDataSetFromFile();
    }
}
