Files
kupshop/bundles/KupShop/WarehouseBundle/Tests/StoreAppStoreInTest.php
2025-08-02 16:30:27 +02:00

64 lines
1.5 KiB
PHP

<?php
namespace KupShop\WarehouseBundle\Tests;
use KupShop\WarehouseBundle\Exception\WarehouseBaseException;
use KupShop\WarehouseBundle\Util\StoreItemWorker;
class StoreAppStoreInTest extends \DatabaseTestCase
{
/** @var StoreItemWorker */
private $worker;
protected function setUp(): void
{
parent::setUp();
$this->worker = $this->get(StoreItemWorker::class);
}
public function testStoreInDuringOrder()
{
// store in items
$this->assertTrue(
$this->worker->storeItemFromTable('4524667587750', 10, 'PRIJEM', 'A1-1')
);
// finish order
$this->expectException(WarehouseBaseException::class);
// finish by nemel projit, protoze na pozici PRIJEM uz produkt neni
$this->worker->finish(1, $this->createState());
}
public function testStoreIn()
{
$this->assertTrue(
$this->worker->storeItemFromTable('4524667587750', 20, 'STUL-PRODEJNA', 'A1-1')
);
}
private function createState()
{
$state = new \stdClass();
$state->checkouts = [];
$item = new \stdClass();
$item->uuid = '28b0f8b4-80aa-42d4-bbec-6f8ce8c46fee';
$item->position = 'PRIJEM';
$item->pieces = 1;
$item->id_item = '1_';
$item->ean = '4524667587750';
$item->date = '2019-04-26T12:19:22.373Z';
$state->checkouts[] = $item;
return $state;
}
protected function getDataSet()
{
return $this->getJsonDataSetFromFile();
}
}