from main app code base
This commit is contained in:
parent
b17634c08a
commit
d9a59fb82b
|
@ -9,7 +9,9 @@ use Cake\Core\ContainerInterface;
|
||||||
use Cake\Core\PluginApplicationInterface;
|
use Cake\Core\PluginApplicationInterface;
|
||||||
use Cake\Http\MiddlewareQueue;
|
use Cake\Http\MiddlewareQueue;
|
||||||
use Cake\Routing\RouteBuilder;
|
use Cake\Routing\RouteBuilder;
|
||||||
|
use CakeProducts\Queue\Task\ProductCategories\CreateTask;
|
||||||
use CakeProducts\Service\CatalogManagerServiceProvider;
|
use CakeProducts\Service\CatalogManagerServiceProvider;
|
||||||
|
use CakeProducts\Service\ExternalCatalogManagerService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin for CakeProducts
|
* Plugin for CakeProducts
|
||||||
|
@ -90,6 +92,5 @@ class CakeProductsPlugin extends BasePlugin
|
||||||
public function services(ContainerInterface $container): void
|
public function services(ContainerInterface $container): void
|
||||||
{
|
{
|
||||||
// Add your services here
|
// Add your services here
|
||||||
$container->addServiceProvider(new CatalogManagerServiceProvider());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,15 @@ declare(strict_types=1);
|
||||||
namespace CakeProducts\Controller;
|
namespace CakeProducts\Controller;
|
||||||
|
|
||||||
use App\Controller\AppController as BaseController;
|
use App\Controller\AppController as BaseController;
|
||||||
|
use Cake\Log\Log;
|
||||||
|
|
||||||
class AppController extends BaseController
|
class AppController extends BaseController
|
||||||
{
|
{
|
||||||
|
function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize(); // TODO: Change the autogenerated stub
|
||||||
|
|
||||||
|
Log::debug('inside cake products app controlleri initialize');
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace CakeProducts\Controller;
|
||||||
|
|
||||||
use Cake\Log\Log;
|
use Cake\Log\Log;
|
||||||
use CakeProducts\Controller\AppController;
|
use CakeProducts\Controller\AppController;
|
||||||
use CakeProducts\Service\InternalCatalogManagerService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ExternalProductCatalogs Controller
|
* ExternalProductCatalogs Controller
|
||||||
|
@ -46,24 +45,18 @@ class ExternalProductCatalogsController extends AppController
|
||||||
*
|
*
|
||||||
* @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
|
* @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
|
||||||
*/
|
*/
|
||||||
public function add(InternalCatalogManagerService $catalogManagerService)
|
public function add()
|
||||||
{
|
{
|
||||||
$externalProductCatalog = $this->ExternalProductCatalogs->newEmptyEntity();
|
$externalProductCatalog = $this->ExternalProductCatalogs->newEmptyEntity();
|
||||||
if ($this->request->is('post')) {
|
if ($this->request->is('post')) {
|
||||||
$postData = $this->request->getData();
|
$externalProductCatalog = $this->ExternalProductCatalogs->patchEntity($externalProductCatalog, $this->request->getData());
|
||||||
if ($this->request->getSession()->read('Auth.User.id')) {
|
if ($this->ExternalProductCatalogs->save($externalProductCatalog)) {
|
||||||
$postData['created_by'] = $this->request->getSession()->read('Auth.User.id');
|
|
||||||
}
|
|
||||||
$result = $catalogManagerService->createNewExternalCatalog($externalProductCatalog, $postData);
|
|
||||||
Log::debug(print_r('$result from createNewExternalCatalog', true));
|
|
||||||
Log::debug(print_r($result, true));
|
|
||||||
if ($result['result']) {
|
|
||||||
$this->Flash->success(__('The external product catalog has been saved.'));
|
$this->Flash->success(__('The external product catalog has been saved.'));
|
||||||
|
|
||||||
return $this->redirect(['action' => 'index']);
|
return $this->redirect(['action' => 'index']);
|
||||||
}
|
}
|
||||||
// Log::debug(print_r('$externalProductCatalog->getErrors() next - failed /add', true));
|
Log::debug(print_r('$externalProductCatalog->getErrors() next - failed /add', true));
|
||||||
// Log::debug(print_r($externalProductCatalog->getErrors(), true));
|
Log::debug(print_r($externalProductCatalog->getErrors(), true));
|
||||||
$this->Flash->error(__('The external product catalog could not be saved. Please, try again.'));
|
$this->Flash->error(__('The external product catalog could not be saved. Please, try again.'));
|
||||||
}
|
}
|
||||||
$productCatalogs = $this->ExternalProductCatalogs->ProductCatalogs->find('list', limit: 200)->all();
|
$productCatalogs = $this->ExternalProductCatalogs->ProductCatalogs->find('list', limit: 200)->all();
|
||||||
|
|
|
@ -3,12 +3,13 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace CakeProducts\Controller;
|
namespace CakeProducts\Controller;
|
||||||
|
|
||||||
|
use Cake\Core\Configure;
|
||||||
use Cake\Datasource\Exception\RecordNotFoundException;
|
use Cake\Datasource\Exception\RecordNotFoundException;
|
||||||
use Cake\Http\Response;
|
use Cake\Http\Response;
|
||||||
use Cake\Log\Log;
|
use Cake\Log\Log;
|
||||||
use CakeProducts\Controller\AppController;
|
use CakeProducts\Controller\AppController;
|
||||||
use CakeProducts\Model\Table\ProductCatalogsTable;
|
use CakeProducts\Model\Table\ProductCatalogsTable;
|
||||||
use CakeProducts\Service\InternalCatalogManagerService;
|
use CakeProducts\Service\CatalogManagerService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ProductCatalogs Controller
|
* ProductCatalogs Controller
|
||||||
|
@ -37,9 +38,13 @@ class ProductCatalogsController extends AppController
|
||||||
* @return Response|null|void Renders view
|
* @return Response|null|void Renders view
|
||||||
* @throws RecordNotFoundException When record not found.
|
* @throws RecordNotFoundException When record not found.
|
||||||
*/
|
*/
|
||||||
public function view(InternalCatalogManagerService $catalogManagerService, $id = null)
|
public function view($id = null)
|
||||||
{
|
{
|
||||||
$productCatalog = $catalogManagerService->getCatalog($id);
|
$contain = ['ProductCategories'];
|
||||||
|
if (Configure::read('CakeProducts.internal.syncExternally', false)) {
|
||||||
|
$contain[] = 'ExternalProductCatalogs';
|
||||||
|
}
|
||||||
|
$productCatalog = $this->ProductCatalogs->get($id, contain: $contain);
|
||||||
$this->set(compact('productCatalog'));
|
$this->set(compact('productCatalog'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,9 @@ declare(strict_types=1);
|
||||||
namespace CakeProducts\Controller;
|
namespace CakeProducts\Controller;
|
||||||
|
|
||||||
use Cake\Log\Log;
|
use Cake\Log\Log;
|
||||||
|
use Cake\Utility\Text;
|
||||||
use CakeProducts\Controller\AppController;
|
use CakeProducts\Controller\AppController;
|
||||||
use CakeProducts\Service\InternalCatalogManagerService;
|
use CakeProducts\Service\CatalogManagerService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ProductCategories Controller
|
* ProductCategories Controller
|
||||||
|
@ -35,9 +36,9 @@ class ProductCategoriesController extends AppController
|
||||||
* @return \Cake\Http\Response|null|void Renders view
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
*/
|
*/
|
||||||
public function view(InternalCatalogManagerService $catalogManagerService, $id = null)
|
public function view($id = null)
|
||||||
{
|
{
|
||||||
$productCategory = $catalogManagerService->getCategory($id);
|
$productCategory = $this->ProductCategories->get($id, contain: ['ProductCatalogs', 'ParentProductCategories', 'ChildProductCategories']);
|
||||||
$this->set(compact('productCategory'));
|
$this->set(compact('productCategory'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,18 +47,26 @@ class ProductCategoriesController extends AppController
|
||||||
*
|
*
|
||||||
* @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
|
* @return \Cake\Http\Response|null|void Redirects on successful add, renders view otherwise.
|
||||||
*/
|
*/
|
||||||
public function add(InternalCatalogManagerService $catalogManagerService)
|
public function add()
|
||||||
{
|
{
|
||||||
$productCategory = $this->ProductCategories->newEmptyEntity();
|
$productCategory = $this->ProductCategories->newEmptyEntity();
|
||||||
if ($this->request->is('post')) {
|
if ($this->request->is('post')) {
|
||||||
$postData = $this->request->getData();
|
$postData = $this->request->getData();
|
||||||
|
$saveOptions = [
|
||||||
|
'associated' => [],
|
||||||
|
];
|
||||||
if ($this->request->getSession()->read('Auth.User.id')) {
|
if ($this->request->getSession()->read('Auth.User.id')) {
|
||||||
$postData['created_by'] = $this->request->getSession()->read('Auth.User.id');
|
$postData['created_by'] = $this->request->getSession()->read('Auth.User.id');
|
||||||
}
|
}
|
||||||
$result = $catalogManagerService->createNewCategory($productCategory, $postData);
|
if (!array_key_exists('internal_id', $postData) || !$postData['internal_id']) {
|
||||||
Log::debug(print_r('$result from createNewCategory', true));
|
$postData['internal_id'] = Text::uuid();
|
||||||
Log::debug(print_r($result, true));
|
}
|
||||||
if ($result['result']) {
|
$productCategory = $this->ProductCategories->patchEntity($productCategory, $postData, $saveOptions);
|
||||||
|
if ($productCategory->getErrors()) {
|
||||||
|
Log::debug(print_r('$productCategory->getErrors() next - failed to save from create new product category', true));
|
||||||
|
Log::debug(print_r($productCategory->getErrors(), true));
|
||||||
|
}
|
||||||
|
if ($this->ProductCategories->save($productCategory, $saveOptions)) {
|
||||||
$this->Flash->success(__('The product category has been saved.'));
|
$this->Flash->success(__('The product category has been saved.'));
|
||||||
|
|
||||||
return $this->redirect(['action' => 'index']);
|
return $this->redirect(['action' => 'index']);
|
||||||
|
@ -65,7 +74,7 @@ class ProductCategoriesController extends AppController
|
||||||
$this->Flash->error(__('The product category could not be saved. Please, try again.'));
|
$this->Flash->error(__('The product category could not be saved. Please, try again.'));
|
||||||
}
|
}
|
||||||
$productCatalogs = $this->ProductCategories->ProductCatalogs->find('list', limit: 200)->all();
|
$productCatalogs = $this->ProductCategories->ProductCatalogs->find('list', limit: 200)->all();
|
||||||
$parentProductCategories = $this->ProductCategories->ParentProductCategories->find('list', limit: 200)->all();
|
$parentProductCategories = $this->ProductCategories->ParentProductCategories->find('treeList', limit: 200)->toArray();
|
||||||
$this->set(compact('productCategory', 'productCatalogs', 'parentProductCategories'));
|
$this->set(compact('productCategory', 'productCatalogs', 'parentProductCategories'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,11 +85,12 @@ class ProductCategoriesController extends AppController
|
||||||
* @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise.
|
* @return \Cake\Http\Response|null|void Redirects on successful edit, renders view otherwise.
|
||||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
*/
|
*/
|
||||||
public function edit(InternalCatalogManagerService $catalogManagerService, $id = null)
|
public function edit($id = null)
|
||||||
{
|
{
|
||||||
$productCategory = $this->ProductCategories->get($id, contain: []);
|
$productCategory = $this->ProductCategories->get($id, contain: []);
|
||||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
$productCategory = $this->ProductCategories->patchEntity($productCategory, $this->request->getData());
|
$postData = $this->request->getData();
|
||||||
|
$productCategory = $this->ProductCategories->patchEntity($productCategory, $postData);
|
||||||
if ($this->ProductCategories->save($productCategory)) {
|
if ($this->ProductCategories->save($productCategory)) {
|
||||||
$this->Flash->success(__('The product category has been saved.'));
|
$this->Flash->success(__('The product category has been saved.'));
|
||||||
|
|
||||||
|
@ -112,4 +122,23 @@ class ProductCategoriesController extends AppController
|
||||||
|
|
||||||
return $this->redirect(['action' => 'index']);
|
return $this->redirect(['action' => 'index']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \Cake\Http\Response|null|void Renders view
|
||||||
|
*/
|
||||||
|
public function select()
|
||||||
|
{
|
||||||
|
$this->ProductCategories->behaviors()->get('Tree')->setConfig([
|
||||||
|
'scope' => [
|
||||||
|
'product_catalog_id' => $this->request->getQuery('product_catalog_id', -1),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
$productCategories = $this->ProductCategories
|
||||||
|
->find('treeList')
|
||||||
|
// ->where(['product_catalog_id' => $this->request->getQuery('product_catalog_id', -1)])
|
||||||
|
->orderBy(['ProductCategories.name'])
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$this->set(compact('productCategories'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ use Cake\Log\Log;
|
||||||
use CakeProducts\Controller\AppController;
|
use CakeProducts\Controller\AppController;
|
||||||
use CakeProducts\Model\Enum\ProductCategoryAttributeTypeId;
|
use CakeProducts\Model\Enum\ProductCategoryAttributeTypeId;
|
||||||
use CakeProducts\Model\Table\ProductCategoryAttributesTable;
|
use CakeProducts\Model\Table\ProductCategoryAttributesTable;
|
||||||
|
use CakeProducts\Service\CatalogManagerService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ProductCategoryAttributes Controller
|
* ProductCategoryAttributes Controller
|
||||||
|
@ -57,18 +58,21 @@ class ProductCategoryAttributesController extends AppController
|
||||||
$productCategoryAttribute = $this->ProductCategoryAttributes->newEmptyEntity();
|
$productCategoryAttribute = $this->ProductCategoryAttributes->newEmptyEntity();
|
||||||
if ($this->request->is('post')) {
|
if ($this->request->is('post')) {
|
||||||
$postData = $this->request->getData();
|
$postData = $this->request->getData();
|
||||||
|
if ($this->request->getSession()->read('Auth.User.id')) {
|
||||||
|
$postData['created_by'] = $this->request->getSession()->read('Auth.User.id');
|
||||||
|
}
|
||||||
|
Log::debug(print_r('$postData', true));
|
||||||
|
Log::debug(print_r($postData, true));
|
||||||
$saveOptions = [
|
$saveOptions = [
|
||||||
'associated' => ['ProductCategoryAttributeOptions'],
|
'associated' => [
|
||||||
|
'ProductCategoryAttributeOptions'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
Log::debug(print_r('$postData', true));
|
|
||||||
Log::debug(print_r($postData, true));
|
|
||||||
// if ($this->request->getData('attribute_type_id') != ProductCategoryAttributeTypeId::Constrained) {
|
|
||||||
// $saveOptions['associated'] = [];
|
|
||||||
// $postData['product_category_attribute_options'] = [];
|
|
||||||
// }
|
|
||||||
Log::debug(print_r('$postData', true));
|
|
||||||
Log::debug(print_r($postData, true));
|
|
||||||
$productCategoryAttribute = $this->ProductCategoryAttributes->patchEntity($productCategoryAttribute, $postData, $saveOptions);
|
$productCategoryAttribute = $this->ProductCategoryAttributes->patchEntity($productCategoryAttribute, $postData, $saveOptions);
|
||||||
|
if ($productCategoryAttribute->getErrors()) {
|
||||||
|
Log::debug(print_r('$productCategoryAttribute->getErrors() next - failed to save from create new product category attribute', true));
|
||||||
|
Log::debug(print_r($productCategoryAttribute->getErrors(), true));
|
||||||
|
}
|
||||||
if ($this->ProductCategoryAttributes->save($productCategoryAttribute, $saveOptions)) {
|
if ($this->ProductCategoryAttributes->save($productCategoryAttribute, $saveOptions)) {
|
||||||
$this->Flash->success(__('The product category attribute has been saved.'));
|
$this->Flash->success(__('The product category attribute has been saved.'));
|
||||||
|
|
||||||
|
@ -79,7 +83,7 @@ class ProductCategoryAttributesController extends AppController
|
||||||
Log::debug(print_r($productCategoryAttribute->getErrors(), true));
|
Log::debug(print_r($productCategoryAttribute->getErrors(), true));
|
||||||
$this->Flash->error(__('The product category attribute could not be saved. Please, try again.'));
|
$this->Flash->error(__('The product category attribute could not be saved. Please, try again.'));
|
||||||
}
|
}
|
||||||
$productCategories = $this->ProductCategoryAttributes->ProductCategories->find('list', limit: 200)->all();
|
$productCategories = $this->ProductCategoryAttributes->ProductCategories->find('list', keyField: 'internal_id', valueField: 'name')->all();
|
||||||
$this->set(compact('productCategoryAttribute', 'productCategories'));
|
$this->set(compact('productCategoryAttribute', 'productCategories'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +122,7 @@ class ProductCategoryAttributesController extends AppController
|
||||||
Log::debug(print_r($productCategoryAttribute->getErrors(), true));
|
Log::debug(print_r($productCategoryAttribute->getErrors(), true));
|
||||||
$this->Flash->error(__('The product category attribute could not be saved. Please, try again.'));
|
$this->Flash->error(__('The product category attribute could not be saved. Please, try again.'));
|
||||||
}
|
}
|
||||||
$productCategories = $this->ProductCategoryAttributes->ProductCategories->find('list', limit: 200)->all();
|
$productCategories = $this->ProductCategoryAttributes->ProductCategories->find('list', limit: 200, keyField: 'internal_id', valueField: 'name')->all();
|
||||||
$this->set(compact('productCategoryAttribute', 'productCategories'));
|
$this->set(compact('productCategoryAttribute', 'productCategories'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ProductsController extends AppController
|
||||||
Log::debug(print_r($product->getErrors(), true));
|
Log::debug(print_r($product->getErrors(), true));
|
||||||
$this->Flash->error(__('The product could not be saved. Please, try again.'));
|
$this->Flash->error(__('The product could not be saved. Please, try again.'));
|
||||||
}
|
}
|
||||||
$productCategories = $this->Products->ProductCategories->find('list', limit: 200)->all();
|
$productCategories = $this->Products->ProductCategories->find('list', keyField: 'internal_id', valueField: 'name' )->all();
|
||||||
$this->set(compact('product', 'productCategories'));
|
$this->set(compact('product', 'productCategories'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,22 +10,6 @@ use Cake\TestSuite\Fixture\TestFixture;
|
||||||
*/
|
*/
|
||||||
class ExternalProductCatalogsFixture extends TestFixture
|
class ExternalProductCatalogsFixture extends TestFixture
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* fields property
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public array $fields = [
|
|
||||||
'id' => ['type' => 'integer'],
|
|
||||||
'product_catalog_id' => ['type' => 'uuid'],
|
|
||||||
'base_url' => ['type' => 'string', 'length' => 255, 'null' => false],
|
|
||||||
'api_url' => ['type' => 'string', 'length' => 255, 'null' => false],
|
|
||||||
'created' => ['type' => 'datetime', 'null' => false],
|
|
||||||
'deleted' => ['type' => 'datetime', 'null' => true],
|
|
||||||
'enabled' => ['type' => 'boolean', 'null' => true],
|
|
||||||
'_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init method
|
* Init method
|
||||||
*
|
*
|
||||||
|
|
|
@ -10,21 +10,6 @@ use Cake\TestSuite\Fixture\TestFixture;
|
||||||
*/
|
*/
|
||||||
class ProductsFixture extends TestFixture
|
class ProductsFixture extends TestFixture
|
||||||
{
|
{
|
||||||
public string $table = 'products';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fields property
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public array $fields = [
|
|
||||||
'id' => ['type' => 'uuid'],
|
|
||||||
'name' => ['type' => 'string', 'length' => 255, 'null' => false],
|
|
||||||
'product_category_id' => ['type' => 'uuid'],
|
|
||||||
'product_type_id' => ['type' => 'integer', 'length' => 11, 'null' => false],
|
|
||||||
'_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init method
|
* Init method
|
||||||
*
|
*
|
||||||
|
|
|
@ -9,13 +9,6 @@ class BaseControllerTest extends TestCase
|
||||||
{
|
{
|
||||||
use IntegrationTestTrait;
|
use IntegrationTestTrait;
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp(); // TODO: Change the autogenerated stub
|
|
||||||
|
|
||||||
$this->loadPlugins(['CakeProducts']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function loginUserByRole(string $role = 'admin'): void
|
public function loginUserByRole(string $role = 'admin'): void
|
||||||
{
|
{
|
||||||
$this->session(['Auth.User.id' => 1]);
|
$this->session(['Auth.User.id' => 1]);
|
||||||
|
|
|
@ -3,6 +3,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace CakeProducts\Test\TestCase\Controller;
|
namespace CakeProducts\Test\TestCase\Controller;
|
||||||
|
|
||||||
|
use Cake\Log\Log;
|
||||||
use Cake\ORM\Table;
|
use Cake\ORM\Table;
|
||||||
use Cake\TestSuite\IntegrationTestTrait;
|
use Cake\TestSuite\IntegrationTestTrait;
|
||||||
use Cake\TestSuite\TestCase;
|
use Cake\TestSuite\TestCase;
|
||||||
|
@ -59,28 +60,6 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test index method
|
|
||||||
*
|
|
||||||
* Tests the index action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @uses \CakeProducts\Controller\ExternalProductCatalogsController::index()
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testIndexGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ExternalProductCatalogs',
|
|
||||||
'action' => 'index',
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test index method
|
* Test index method
|
||||||
*
|
*
|
||||||
|
@ -91,8 +70,9 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testIndexGetLoggedIn(): void
|
public function testIndexGet(): void
|
||||||
{
|
{
|
||||||
|
Log::debug('inside testIndexGet ExternalProductCatalogsControllerTest');
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$url = [
|
$url = [
|
||||||
'plugin' => 'CakeProducts',
|
'plugin' => 'CakeProducts',
|
||||||
|
@ -103,30 +83,6 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
$this->assertResponseCode(200);
|
$this->assertResponseCode(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test view method
|
|
||||||
*
|
|
||||||
* Tests the view action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @uses \CakeProducts\Controller\ExternalProductCatalogsController::view()
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testViewGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$id = 1;
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ExternalProductCatalogs',
|
|
||||||
'action' => 'view',
|
|
||||||
$id,
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test view method
|
* Test view method
|
||||||
*
|
*
|
||||||
|
@ -137,7 +93,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testViewGetLoggedIn(): void
|
public function testViewGet(): void
|
||||||
{
|
{
|
||||||
$id = 1;
|
$id = 1;
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
|
@ -151,32 +107,6 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
$this->assertResponseCode(200);
|
$this->assertResponseCode(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test add method
|
|
||||||
*
|
|
||||||
* Tests the add action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @uses \CakeProducts\Controller\ExternalProductCatalogsController::add()
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testAddGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$cntBefore = $this->ExternalProductCatalogs->find()->count();
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ExternalProductCatalogs',
|
|
||||||
'action' => 'add',
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
|
|
||||||
$cntAfter = $this->ExternalProductCatalogs->find()->count();
|
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test add method
|
* Test add method
|
||||||
*
|
*
|
||||||
|
@ -187,7 +117,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAddGetLoggedIn(): void
|
public function testAddGet(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ExternalProductCatalogs->find()->count();
|
$cntBefore = $this->ExternalProductCatalogs->find()->count();
|
||||||
|
|
||||||
|
@ -214,7 +144,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAddPostLoggedInSuccess(): void
|
public function testAddPostSuccess(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ExternalProductCatalogs->find()->count();
|
$cntBefore = $this->ExternalProductCatalogs->find()->count();
|
||||||
|
|
||||||
|
@ -248,7 +178,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAddPostLoggedInFailure(): void
|
public function testAddPostFailure(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ExternalProductCatalogs->find()->count();
|
$cntBefore = $this->ExternalProductCatalogs->find()->count();
|
||||||
|
|
||||||
|
@ -271,29 +201,6 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
$this->assertEquals($cntBefore, $cntAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test edit method
|
|
||||||
*
|
|
||||||
* Tests the edit action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @uses \CakeProducts\Controller\ExternalProductCatalogsController::edit()
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testEditGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ExternalProductCatalogs',
|
|
||||||
'action' => 'edit',
|
|
||||||
1,
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test edit method
|
* Test edit method
|
||||||
*
|
*
|
||||||
|
@ -304,7 +211,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testEditGetLoggedIn(): void
|
public function testEditGet(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$url = [
|
$url = [
|
||||||
|
@ -327,7 +234,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testEditPutLoggedInSuccess(): void
|
public function testEditPutSuccess(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$id = 1;
|
$id = 1;
|
||||||
|
@ -363,7 +270,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testEditPutLoggedInFailure(): void
|
public function testEditPutFailure(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$id = 1;
|
$id = 1;
|
||||||
|
@ -387,34 +294,6 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
// assert save failed below
|
// assert save failed below
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test delete method
|
|
||||||
*
|
|
||||||
* Tests the delete action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @uses \CakeProducts\Controller\ExternalProductCatalogsController::delete()
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testDeleteUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$cntBefore = $this->ExternalProductCatalogs->find()->count();
|
|
||||||
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ExternalProductCatalogs',
|
|
||||||
'action' => 'delete',
|
|
||||||
1,
|
|
||||||
];
|
|
||||||
$this->delete($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
|
|
||||||
$cntAfter = $this->ExternalProductCatalogs->find()->count();
|
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test delete method
|
* Test delete method
|
||||||
*
|
*
|
||||||
|
@ -425,7 +304,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDeleteLoggedIn(): void
|
public function testDelete(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ExternalProductCatalogs->find()->count();
|
$cntBefore = $this->ExternalProductCatalogs->find()->count();
|
||||||
|
|
||||||
|
|
|
@ -60,28 +60,6 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test index method
|
|
||||||
*
|
|
||||||
* Tests the index action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @uses ProductCatalogsController::index()
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testIndexGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCatalogs',
|
|
||||||
'action' => 'index',
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test index method
|
* Test index method
|
||||||
*
|
*
|
||||||
|
@ -92,7 +70,7 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testIndexGetLoggedIn(): void
|
public function testIndexGet(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$url = [
|
$url = [
|
||||||
|
@ -104,30 +82,6 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
$this->assertResponseCode(200);
|
$this->assertResponseCode(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test view method
|
|
||||||
*
|
|
||||||
* Tests the view action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @uses ProductCatalogsController::view()
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testViewGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$id = '115153f3-2f59-4234-8ff8-e1b205761428';
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCatalogs',
|
|
||||||
'action' => 'view',
|
|
||||||
$id,
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test view method
|
* Test view method
|
||||||
*
|
*
|
||||||
|
@ -138,7 +92,7 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testViewGetLoggedIn(): void
|
public function testViewGet(): void
|
||||||
{
|
{
|
||||||
$id = '115153f3-2f59-4234-8ff8-e1b205761428';
|
$id = '115153f3-2f59-4234-8ff8-e1b205761428';
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
|
@ -152,32 +106,6 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
$this->assertResponseCode(200);
|
$this->assertResponseCode(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test add method
|
|
||||||
*
|
|
||||||
* Tests the add action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @uses ProductCatalogsController::add()
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testAddGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$cntBefore = $this->ProductCatalogs->find()->count();
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCatalogs',
|
|
||||||
'action' => 'add',
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
|
|
||||||
$cntAfter = $this->ProductCatalogs->find()->count();
|
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test add method
|
* Test add method
|
||||||
*
|
*
|
||||||
|
@ -188,7 +116,7 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAddGetLoggedIn(): void
|
public function testAddGet(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCatalogs->find()->count();
|
$cntBefore = $this->ProductCatalogs->find()->count();
|
||||||
|
|
||||||
|
@ -215,7 +143,7 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAddPostLoggedInSuccess(): void
|
public function testAddPostSuccess(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCatalogs->find()->count();
|
$cntBefore = $this->ProductCatalogs->find()->count();
|
||||||
|
|
||||||
|
@ -248,7 +176,7 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAddPostLoggedInFailure(): void
|
public function testAddPostFailure(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCatalogs->find()->count();
|
$cntBefore = $this->ProductCatalogs->find()->count();
|
||||||
|
|
||||||
|
@ -270,30 +198,6 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
$this->assertEquals($cntBefore, $cntAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test edit method
|
|
||||||
*
|
|
||||||
* Tests the edit action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @uses ProductCatalogsController::edit()
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testEditGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$id = '115153f3-2f59-4234-8ff8-e1b205761428';
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCatalogs',
|
|
||||||
'action' => 'edit',
|
|
||||||
$id,
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test edit method
|
* Test edit method
|
||||||
*
|
*
|
||||||
|
@ -304,7 +208,7 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testEditGetLoggedIn(): void
|
public function testEditGet(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$id = '115153f3-2f59-4234-8ff8-e1b205761428';
|
$id = '115153f3-2f59-4234-8ff8-e1b205761428';
|
||||||
|
@ -328,7 +232,7 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testEditPutLoggedInSuccess(): void
|
public function testEditPutSuccess(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$id = '115153f3-2f59-4234-8ff8-e1b205761428';
|
$id = '115153f3-2f59-4234-8ff8-e1b205761428';
|
||||||
|
@ -366,7 +270,7 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testEditPutLoggedInFailure(): void
|
public function testEditPutFailure(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$id = '115153f3-2f59-4234-8ff8-e1b205761428';
|
$id = '115153f3-2f59-4234-8ff8-e1b205761428';
|
||||||
|
@ -390,34 +294,6 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
// assert save failed below
|
// assert save failed below
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test delete method
|
|
||||||
*
|
|
||||||
* Tests the delete action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @uses ProductCatalogsController::delete()
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testDeleteUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$cntBefore = $this->ProductCatalogs->find()->count();
|
|
||||||
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCatalogs',
|
|
||||||
'action' => 'delete',
|
|
||||||
1,
|
|
||||||
];
|
|
||||||
$this->delete($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
|
|
||||||
$cntAfter = $this->ProductCatalogs->find()->count();
|
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test delete method
|
* Test delete method
|
||||||
*
|
*
|
||||||
|
@ -428,7 +304,7 @@ class ProductCatalogsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testDeleteLoggedIn(): void
|
public function testDelete(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCatalogs->find()->count();
|
$cntBefore = $this->ProductCatalogs->find()->count();
|
||||||
|
|
||||||
|
|
|
@ -59,28 +59,6 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test index method
|
|
||||||
*
|
|
||||||
* Tests the index action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductCategoriesController::index
|
|
||||||
*/
|
|
||||||
public function testIndexGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCategories',
|
|
||||||
'action' => 'index',
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test index method
|
* Test index method
|
||||||
*
|
*
|
||||||
|
@ -91,7 +69,7 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoriesController::index
|
* @uses ProductCategoriesController::index
|
||||||
*/
|
*/
|
||||||
public function testIndexGetLoggedIn(): void
|
public function testIndexGet(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$url = [
|
$url = [
|
||||||
|
@ -103,30 +81,6 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
$this->assertResponseCode(200);
|
$this->assertResponseCode(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test view method
|
|
||||||
*
|
|
||||||
* Tests the view action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductCategoriesController::view
|
|
||||||
*/
|
|
||||||
public function testViewGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$id = 1;
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCategories',
|
|
||||||
'action' => 'view',
|
|
||||||
$id,
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test view method
|
* Test view method
|
||||||
*
|
*
|
||||||
|
@ -137,7 +91,7 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoriesController::view
|
* @uses ProductCategoriesController::view
|
||||||
*/
|
*/
|
||||||
public function testViewGetLoggedIn(): void
|
public function testViewGet(): void
|
||||||
{
|
{
|
||||||
$id = 1;
|
$id = 1;
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
|
@ -151,32 +105,6 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
$this->assertResponseCode(200);
|
$this->assertResponseCode(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test add method
|
|
||||||
*
|
|
||||||
* Tests the add action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductCategoriesController::add
|
|
||||||
*/
|
|
||||||
public function testAddGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$cntBefore = $this->ProductCategories->find()->count();
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCategories',
|
|
||||||
'action' => 'add',
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
|
|
||||||
$cntAfter = $this->ProductCategories->find()->count();
|
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test add method
|
* Test add method
|
||||||
*
|
*
|
||||||
|
@ -187,7 +115,7 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoriesController::add
|
* @uses ProductCategoriesController::add
|
||||||
*/
|
*/
|
||||||
public function testAddGetLoggedIn(): void
|
public function testAddGet(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCategories->find()->count();
|
$cntBefore = $this->ProductCategories->find()->count();
|
||||||
|
|
||||||
|
@ -214,7 +142,7 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoriesController::add
|
* @uses ProductCategoriesController::add
|
||||||
*/
|
*/
|
||||||
public function testAddPostLoggedInSuccess(): void
|
public function testAddPostSuccess(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCategories->find()->count();
|
$cntBefore = $this->ProductCategories->find()->count();
|
||||||
|
|
||||||
|
@ -249,7 +177,7 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoriesController::add
|
* @uses ProductCategoriesController::add
|
||||||
*/
|
*/
|
||||||
public function testAddPostLoggedInFailure(): void
|
public function testAddPostFailure(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCategories->find()->count();
|
$cntBefore = $this->ProductCategories->find()->count();
|
||||||
|
|
||||||
|
@ -273,29 +201,6 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
$this->assertEquals($cntBefore, $cntAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test edit method
|
|
||||||
*
|
|
||||||
* Tests the edit action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductCategoriesController::edit
|
|
||||||
*/
|
|
||||||
public function testEditGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCategories',
|
|
||||||
'action' => 'edit',
|
|
||||||
1,
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test edit method
|
* Test edit method
|
||||||
*
|
*
|
||||||
|
@ -306,7 +211,7 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoriesController::edit
|
* @uses ProductCategoriesController::edit
|
||||||
*/
|
*/
|
||||||
public function testEditGetLoggedIn(): void
|
public function testEditGet(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$url = [
|
$url = [
|
||||||
|
@ -329,7 +234,7 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoriesController::edit
|
* @uses ProductCategoriesController::edit
|
||||||
*/
|
*/
|
||||||
public function testEditPutLoggedInSuccess(): void
|
public function testEditPutSuccess(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$id = 1;
|
$id = 1;
|
||||||
|
@ -371,7 +276,7 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoriesController::edit
|
* @uses ProductCategoriesController::edit
|
||||||
*/
|
*/
|
||||||
public function testEditPutLoggedInFailure(): void
|
public function testEditPutFailure(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$id = 1;
|
$id = 1;
|
||||||
|
@ -396,34 +301,6 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
// assert save failed below
|
// assert save failed below
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test delete method
|
|
||||||
*
|
|
||||||
* Tests the delete action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductCategoriesController::delete
|
|
||||||
*/
|
|
||||||
public function testDeleteUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$cntBefore = $this->ProductCategories->find()->count();
|
|
||||||
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCategories',
|
|
||||||
'action' => 'delete',
|
|
||||||
1,
|
|
||||||
];
|
|
||||||
$this->delete($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
|
|
||||||
$cntAfter = $this->ProductCategories->find()->count();
|
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test delete method
|
* Test delete method
|
||||||
*
|
*
|
||||||
|
@ -434,7 +311,7 @@ class ProductCategoriesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoriesController::delete
|
* @uses ProductCategoriesController::delete
|
||||||
*/
|
*/
|
||||||
public function testDeleteLoggedIn(): void
|
public function testDelete(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCategories->find()->count();
|
$cntBefore = $this->ProductCategories->find()->count();
|
||||||
|
|
||||||
|
|
|
@ -58,32 +58,6 @@ class ProductCategoryAttributeOptionsControllerTest extends BaseControllerTest
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test add method
|
|
||||||
*
|
|
||||||
* Tests the add action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses CustomersContactsController::add
|
|
||||||
*/
|
|
||||||
public function testAddGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$cntBefore = $this->ProductCategoryAttributeOptions->find()->count();
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCategoryAttributeOptions',
|
|
||||||
'action' => 'add',
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
|
|
||||||
$cntAfter = $this->ProductCategoryAttributeOptions->find()->count();
|
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test add method
|
* Test add method
|
||||||
*
|
*
|
||||||
|
@ -94,7 +68,7 @@ class ProductCategoryAttributeOptionsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses CustomersContactsController::add
|
* @uses CustomersContactsController::add
|
||||||
*/
|
*/
|
||||||
public function testAddGetLoggedIn(): void
|
public function testAddGet(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCategoryAttributeOptions->find()->count();
|
$cntBefore = $this->ProductCategoryAttributeOptions->find()->count();
|
||||||
|
|
||||||
|
@ -121,7 +95,7 @@ class ProductCategoryAttributeOptionsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses CustomersContactsController::add
|
* @uses CustomersContactsController::add
|
||||||
*/
|
*/
|
||||||
public function testAddPostLoggedInHasNoEffect(): void
|
public function testAddPostHasNoEffect(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCategoryAttributeOptions->find()->count();
|
$cntBefore = $this->ProductCategoryAttributeOptions->find()->count();
|
||||||
|
|
||||||
|
@ -139,34 +113,6 @@ class ProductCategoryAttributeOptionsControllerTest extends BaseControllerTest
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
$this->assertEquals($cntBefore, $cntAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test delete method
|
|
||||||
*
|
|
||||||
* Tests the delete action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses CustomersContactsController::delete
|
|
||||||
*/
|
|
||||||
public function testDeleteUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$cntBefore = $this->ProductCategoryAttributeOptions->find()->count();
|
|
||||||
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCategoryAttributeOptions',
|
|
||||||
'action' => 'delete',
|
|
||||||
'e06f1723-2456-483a-b3c4-004603e032a8',
|
|
||||||
];
|
|
||||||
$this->delete($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
|
|
||||||
$cntAfter = $this->ProductCategoryAttributeOptions->find()->count();
|
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test delete method
|
* Test delete method
|
||||||
*
|
*
|
||||||
|
@ -177,7 +123,7 @@ class ProductCategoryAttributeOptionsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses CustomersContactsController::delete
|
* @uses CustomersContactsController::delete
|
||||||
*/
|
*/
|
||||||
public function testDeleteLoggedIn(): void
|
public function testDelete(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCategoryAttributeOptions->find()->count();
|
$cntBefore = $this->ProductCategoryAttributeOptions->find()->count();
|
||||||
|
|
||||||
|
|
|
@ -60,28 +60,6 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test index method
|
|
||||||
*
|
|
||||||
* Tests the index action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductCategoryAttributesController::index
|
|
||||||
*/
|
|
||||||
public function testIndexGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCategoryAttributes',
|
|
||||||
'action' => 'index',
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test index method
|
* Test index method
|
||||||
*
|
*
|
||||||
|
@ -92,7 +70,7 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoryAttributesController::index
|
* @uses ProductCategoryAttributesController::index
|
||||||
*/
|
*/
|
||||||
public function testIndexGetLoggedIn(): void
|
public function testIndexGet(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$url = [
|
$url = [
|
||||||
|
@ -104,30 +82,6 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
$this->assertResponseCode(200);
|
$this->assertResponseCode(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test view method
|
|
||||||
*
|
|
||||||
* Tests the view action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductCategoryAttributesController::view
|
|
||||||
*/
|
|
||||||
public function testViewGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$id = '37078cf0-0130-4b93-bb7e-abe7d665ed2c';
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCategoryAttributes',
|
|
||||||
'action' => 'view',
|
|
||||||
$id,
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test view method
|
* Test view method
|
||||||
*
|
*
|
||||||
|
@ -138,7 +92,7 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoryAttributesController::view
|
* @uses ProductCategoryAttributesController::view
|
||||||
*/
|
*/
|
||||||
public function testViewGetLoggedIn(): void
|
public function testViewGet(): void
|
||||||
{
|
{
|
||||||
$id = '37078cf0-0130-4b93-bb7e-abe7d665ed2c';
|
$id = '37078cf0-0130-4b93-bb7e-abe7d665ed2c';
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
|
@ -152,32 +106,6 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
$this->assertResponseCode(200);
|
$this->assertResponseCode(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test add method
|
|
||||||
*
|
|
||||||
* Tests the add action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductCategoryAttributesController::add
|
|
||||||
*/
|
|
||||||
public function testAddGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$cntBefore = $this->ProductCategoryAttributes->find()->count();
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCategoryAttributes',
|
|
||||||
'action' => 'add',
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
|
|
||||||
$cntAfter = $this->ProductCategoryAttributes->find()->count();
|
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test add method
|
* Test add method
|
||||||
*
|
*
|
||||||
|
@ -188,7 +116,7 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoryAttributesController::add
|
* @uses ProductCategoryAttributesController::add
|
||||||
*/
|
*/
|
||||||
public function testAddGetLoggedIn(): void
|
public function testAddGet(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCategoryAttributes->find()->count();
|
$cntBefore = $this->ProductCategoryAttributes->find()->count();
|
||||||
|
|
||||||
|
@ -215,7 +143,7 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoryAttributesController::add
|
* @uses ProductCategoryAttributesController::add
|
||||||
*/
|
*/
|
||||||
public function testAddPostLoggedInSuccess(): void
|
public function testAddPostSuccess(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCategoryAttributes->find()->count();
|
$cntBefore = $this->ProductCategoryAttributes->find()->count();
|
||||||
|
|
||||||
|
@ -249,7 +177,7 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoryAttributesController::add
|
* @uses ProductCategoryAttributesController::add
|
||||||
*/
|
*/
|
||||||
public function testAddPostLoggedInSuccessConstrainedWithOptions(): void
|
public function testAddPostSuccessConstrainedWithOptions(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCategoryAttributes->find()->count();
|
$cntBefore = $this->ProductCategoryAttributes->find()->count();
|
||||||
$cntOptionsBefore = $this->ProductCategoryAttributes->ProductCategoryAttributeOptions->find()->count();
|
$cntOptionsBefore = $this->ProductCategoryAttributes->ProductCategoryAttributeOptions->find()->count();
|
||||||
|
@ -299,7 +227,7 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoryAttributesController::add
|
* @uses ProductCategoryAttributesController::add
|
||||||
*/
|
*/
|
||||||
public function testAddPostLoggedInFailure(): void
|
public function testAddPostFailure(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCategoryAttributes->find()->count();
|
$cntBefore = $this->ProductCategoryAttributes->find()->count();
|
||||||
|
|
||||||
|
@ -322,29 +250,6 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
$this->assertEquals($cntBefore, $cntAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test edit method
|
|
||||||
*
|
|
||||||
* Tests the edit action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductCategoryAttributesController::edit
|
|
||||||
*/
|
|
||||||
public function testEditGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCategoryAttributes',
|
|
||||||
'action' => 'edit',
|
|
||||||
'37078cf0-0130-4b93-bb7e-abe7d665ed2c',
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test edit method
|
* Test edit method
|
||||||
*
|
*
|
||||||
|
@ -355,7 +260,7 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoryAttributesController::edit
|
* @uses ProductCategoryAttributesController::edit
|
||||||
*/
|
*/
|
||||||
public function testEditGetLoggedIn(): void
|
public function testEditGet(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$url = [
|
$url = [
|
||||||
|
@ -378,7 +283,7 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoryAttributesController::edit
|
* @uses ProductCategoryAttributesController::edit
|
||||||
*/
|
*/
|
||||||
public function testEditPutLoggedInSuccess(): void
|
public function testEditPutSuccess(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$id = '37078cf0-0130-4b93-bb7e-abe7d665ed2c';
|
$id = '37078cf0-0130-4b93-bb7e-abe7d665ed2c';
|
||||||
|
@ -415,7 +320,7 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoryAttributesController::edit
|
* @uses ProductCategoryAttributesController::edit
|
||||||
*/
|
*/
|
||||||
public function testEditPutLoggedInFailure(): void
|
public function testEditPutFailure(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$id = '37078cf0-0130-4b93-bb7e-abe7d665ed2c';
|
$id = '37078cf0-0130-4b93-bb7e-abe7d665ed2c';
|
||||||
|
@ -439,34 +344,6 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
// assert save failed below
|
// assert save failed below
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test delete method
|
|
||||||
*
|
|
||||||
* Tests the delete action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductCategoryAttributesController::delete
|
|
||||||
*/
|
|
||||||
public function testDeleteUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$cntBefore = $this->ProductCategoryAttributes->find()->count();
|
|
||||||
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'ProductCategoryAttributes',
|
|
||||||
'action' => 'delete',
|
|
||||||
'37078cf0-0130-4b93-bb7e-abe7d665ed2c',
|
|
||||||
];
|
|
||||||
$this->delete($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
|
|
||||||
$cntAfter = $this->ProductCategoryAttributes->find()->count();
|
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test delete method
|
* Test delete method
|
||||||
*
|
*
|
||||||
|
@ -477,7 +354,7 @@ class ProductCategoryAttributesControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductCategoryAttributesController::delete
|
* @uses ProductCategoryAttributesController::delete
|
||||||
*/
|
*/
|
||||||
public function testDeleteLoggedIn(): void
|
public function testDelete(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->ProductCategoryAttributes->find()->count();
|
$cntBefore = $this->ProductCategoryAttributes->find()->count();
|
||||||
|
|
||||||
|
|
|
@ -62,28 +62,6 @@ class ProductsControllerTest extends BaseControllerTest
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test index method
|
|
||||||
*
|
|
||||||
* Tests the index action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductsController::index
|
|
||||||
*/
|
|
||||||
public function testIndexGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'Products',
|
|
||||||
'action' => 'index',
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test index method
|
* Test index method
|
||||||
*
|
*
|
||||||
|
@ -94,7 +72,7 @@ class ProductsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductsController::index
|
* @uses ProductsController::index
|
||||||
*/
|
*/
|
||||||
public function testIndexGetLoggedIn(): void
|
public function testIndexGet(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$url = [
|
$url = [
|
||||||
|
@ -106,30 +84,6 @@ class ProductsControllerTest extends BaseControllerTest
|
||||||
$this->assertResponseCode(200);
|
$this->assertResponseCode(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test view method
|
|
||||||
*
|
|
||||||
* Tests the view action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductsController::view
|
|
||||||
*/
|
|
||||||
public function testViewGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$id = 'cfc98a9a-29b2-44c8-b587-8156adc05317';
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'Products',
|
|
||||||
'action' => 'view',
|
|
||||||
$id,
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test view method
|
* Test view method
|
||||||
*
|
*
|
||||||
|
@ -140,7 +94,7 @@ class ProductsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductsController::view
|
* @uses ProductsController::view
|
||||||
*/
|
*/
|
||||||
public function testViewGetLoggedIn(): void
|
public function testViewGet(): void
|
||||||
{
|
{
|
||||||
$id = 'cfc98a9a-29b2-44c8-b587-8156adc05317';
|
$id = 'cfc98a9a-29b2-44c8-b587-8156adc05317';
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
|
@ -154,32 +108,6 @@ class ProductsControllerTest extends BaseControllerTest
|
||||||
$this->assertResponseCode(200);
|
$this->assertResponseCode(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test add method
|
|
||||||
*
|
|
||||||
* Tests the add action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductsController::add
|
|
||||||
*/
|
|
||||||
public function testAddGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$cntBefore = $this->Products->find()->count();
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'Products',
|
|
||||||
'action' => 'add',
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
|
|
||||||
$cntAfter = $this->Products->find()->count();
|
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test add method
|
* Test add method
|
||||||
*
|
*
|
||||||
|
@ -190,7 +118,7 @@ class ProductsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductsController::add
|
* @uses ProductsController::add
|
||||||
*/
|
*/
|
||||||
public function testAddGetLoggedIn(): void
|
public function testAddGet(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->Products->find()->count();
|
$cntBefore = $this->Products->find()->count();
|
||||||
|
|
||||||
|
@ -217,41 +145,7 @@ class ProductsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductsController::add
|
* @uses ProductsController::add
|
||||||
*/
|
*/
|
||||||
public function testAddPostLoggedInSuccess(): void
|
public function testAddPostFailure(): void
|
||||||
{
|
|
||||||
$cntBefore = $this->Products->find()->count();
|
|
||||||
|
|
||||||
$this->loginUserByRole('admin');
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'Products',
|
|
||||||
'action' => 'add',
|
|
||||||
];
|
|
||||||
$data = [
|
|
||||||
'product_catalog_id' => '115153f3-2f59-4234-8ff8-e1b205761428',
|
|
||||||
'product_category_id' => '6d223283-361b-4f9f-a7f1-c97aa0ca4c23',
|
|
||||||
'name' => '16AWG WIRE RED',
|
|
||||||
'product_type_id' => 1,
|
|
||||||
];
|
|
||||||
$this->post($url, $data);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('products');
|
|
||||||
|
|
||||||
$cntAfter = $this->Products->find()->count();
|
|
||||||
$this->assertEquals($cntBefore + 1, $cntAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test add method
|
|
||||||
*
|
|
||||||
* Tests a POST request to the add action with a logged in user
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductsController::add
|
|
||||||
*/
|
|
||||||
public function testAddPostLoggedInFailure(): void
|
|
||||||
{
|
{
|
||||||
$cntBefore = $this->Products->find()->count();
|
$cntBefore = $this->Products->find()->count();
|
||||||
|
|
||||||
|
@ -274,29 +168,6 @@ class ProductsControllerTest extends BaseControllerTest
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
$this->assertEquals($cntBefore, $cntAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test edit method
|
|
||||||
*
|
|
||||||
* Tests the edit action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductsController::edit
|
|
||||||
*/
|
|
||||||
public function testEditGetUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'Products',
|
|
||||||
'action' => 'edit',
|
|
||||||
'cfc98a9a-29b2-44c8-b587-8156adc05317',
|
|
||||||
];
|
|
||||||
$this->get($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test edit method
|
* Test edit method
|
||||||
*
|
*
|
||||||
|
@ -307,7 +178,7 @@ class ProductsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductsController::edit
|
* @uses ProductsController::edit
|
||||||
*/
|
*/
|
||||||
public function testEditGetLoggedIn(): void
|
public function testEditGet(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$url = [
|
$url = [
|
||||||
|
@ -330,7 +201,7 @@ class ProductsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductsController::edit
|
* @uses ProductsController::edit
|
||||||
*/
|
*/
|
||||||
public function testEditPutLoggedInSuccess(): void
|
public function testEditPutSuccess(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$id = 'cfc98a9a-29b2-44c8-b587-8156adc05317';
|
$id = 'cfc98a9a-29b2-44c8-b587-8156adc05317';
|
||||||
|
@ -368,7 +239,7 @@ class ProductsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductsController::edit
|
* @uses ProductsController::edit
|
||||||
*/
|
*/
|
||||||
public function testEditPutLoggedInFailure(): void
|
public function testEditPutFailure(): void
|
||||||
{
|
{
|
||||||
$this->loginUserByRole('admin');
|
$this->loginUserByRole('admin');
|
||||||
$id = 'cfc98a9a-29b2-44c8-b587-8156adc05317';
|
$id = 'cfc98a9a-29b2-44c8-b587-8156adc05317';
|
||||||
|
@ -393,34 +264,6 @@ class ProductsControllerTest extends BaseControllerTest
|
||||||
// assert save failed below
|
// assert save failed below
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test delete method
|
|
||||||
*
|
|
||||||
* Tests the delete action with an unauthenticated user (not logged in)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @throws Exception
|
|
||||||
*
|
|
||||||
* @uses ProductsController::delete
|
|
||||||
*/
|
|
||||||
public function testDeleteUnauthenticated(): void
|
|
||||||
{
|
|
||||||
$cntBefore = $this->Products->find()->count();
|
|
||||||
|
|
||||||
$url = [
|
|
||||||
'plugin' => 'CakeProducts',
|
|
||||||
'controller' => 'Products',
|
|
||||||
'action' => 'delete',
|
|
||||||
'cfc98a9a-29b2-44c8-b587-8156adc05317',
|
|
||||||
];
|
|
||||||
$this->delete($url);
|
|
||||||
$this->assertResponseCode(302);
|
|
||||||
$this->assertRedirectContains('login');
|
|
||||||
|
|
||||||
$cntAfter = $this->Products->find()->count();
|
|
||||||
$this->assertEquals($cntBefore, $cntAfter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test delete method
|
* Test delete method
|
||||||
*
|
*
|
||||||
|
@ -431,7 +274,7 @@ class ProductsControllerTest extends BaseControllerTest
|
||||||
*
|
*
|
||||||
* @uses ProductsController::delete
|
* @uses ProductsController::delete
|
||||||
*/
|
*/
|
||||||
public function testDeleteLoggedIn(): void
|
public function testDelete(): void
|
||||||
{
|
{
|
||||||
$cntBefore = $this->Products->find()->count();
|
$cntBefore = $this->Products->find()->count();
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ class ProductCategoriesTableTest extends TestCase
|
||||||
'ParentProductCategories',
|
'ParentProductCategories',
|
||||||
'ChildProductCategories',
|
'ChildProductCategories',
|
||||||
// 'Products',
|
// 'Products',
|
||||||
// 'ProductCategoryAttributes',
|
'ProductCategoryAttributes',
|
||||||
];
|
];
|
||||||
$associations = $this->ProductCategories->associations();
|
$associations = $this->ProductCategories->associations();
|
||||||
|
|
||||||
|
|
205
tests/schema.sql
205
tests/schema.sql
|
@ -1,204 +1 @@
|
||||||
/*!999999\- enable the sandbox mode */
|
-- Test database schema for CakeProducts
|
||||||
-- MariaDB dump 10.19 Distrib 10.6.18-MariaDB, for debian-linux-gnu (x86_64)
|
|
||||||
--
|
|
||||||
-- Host: localhost Database: open_erp
|
|
||||||
-- ------------------------------------------------------
|
|
||||||
-- Server version 10.6.18-MariaDB-0ubuntu0.22.04.1
|
|
||||||
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
|
||||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
|
||||||
/*!40101 SET NAMES utf8mb4 */;
|
|
||||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
|
||||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
|
||||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
|
||||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
|
||||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
|
||||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `product_catalogs`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `product_catalogs`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `product_catalogs` (
|
|
||||||
`id` char(36) NOT NULL,
|
|
||||||
`name` varchar(255) NOT NULL,
|
|
||||||
`catalog_description` varchar(255) DEFAULT NULL,
|
|
||||||
`enabled` tinyint(1) NOT NULL,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `BY_NAME` (`name`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `product_catalogs`
|
|
||||||
--
|
|
||||||
|
|
||||||
LOCK TABLES `product_catalogs` WRITE;
|
|
||||||
/*!40000 ALTER TABLE `product_catalogs` DISABLE KEYS */;
|
|
||||||
INSERT INTO `product_catalogs` VALUES ('115153f3-2f59-4234-8ff8-e1b205761428','Automotive','',1),('f56f3412-ed23-490b-be6e-016208c415d2','Software','',1);
|
|
||||||
/*!40000 ALTER TABLE `product_catalogs` ENABLE KEYS */;
|
|
||||||
UNLOCK TABLES;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `product_categories`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `product_categories`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `product_categories` (
|
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`product_catalog_id` char(36) NOT NULL,
|
|
||||||
`internal_id` char(36) NOT NULL,
|
|
||||||
`name` varchar(255) NOT NULL,
|
|
||||||
`category_description` text DEFAULT NULL,
|
|
||||||
`parent_id` int(11) DEFAULT NULL,
|
|
||||||
`lft` int(11) NOT NULL,
|
|
||||||
`rght` int(11) NOT NULL,
|
|
||||||
`enabled` tinyint(1) NOT NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `BY_NAME_AND_CATALOG_ID` (`product_catalog_id`,`name`),
|
|
||||||
KEY `parent_id` (`parent_id`),
|
|
||||||
KEY `lft` (`lft`),
|
|
||||||
KEY `product_catalog_id` (`product_catalog_id`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `product_categories`
|
|
||||||
--
|
|
||||||
|
|
||||||
LOCK TABLES `product_categories` WRITE;
|
|
||||||
/*!40000 ALTER TABLE `product_categories` DISABLE KEYS */;
|
|
||||||
INSERT INTO `product_categories` VALUES (1,'115153f3-2f59-4234-8ff8-e1b205761428','db4b4273-eddc-46d4-93c8-45cf7c6e058e','Engine','',NULL,1,4,1),(2,'115153f3-2f59-4234-8ff8-e1b205761428','3c2377c5-b97c-4bc9-9660-8f77b4893d8b','Engine Internals','',1,2,3,1),(3,'115153f3-2f59-4234-8ff8-e1b205761428','fbee6709-396f-4bb4-b60b-e125b0bc4e83','Electrical','',NULL,5,8,1),(4,'115153f3-2f59-4234-8ff8-e1b205761428','6d223283-361b-4f9f-a7f1-c97aa0ca4c23','Wiring','',3,6,7,1),(5,'115153f3-2f59-4234-8ff8-e1b205761428','c447b6f4-0fb1-4d59-ba45-5613829a725a','Suspension','',NULL,9,12,1),(6,'115153f3-2f59-4234-8ff8-e1b205761428','1e749d3b-aee0-48a5-8d6c-8cf2b83e9b6e','Coilovers','',5,10,11,1),(7,'f56f3412-ed23-490b-be6e-016208c415d2','8c89a3ca-d56f-46bf-a738-7e85b3342b2a','Support','',NULL,1,2,1);
|
|
||||||
/*!40000 ALTER TABLE `product_categories` ENABLE KEYS */;
|
|
||||||
UNLOCK TABLES;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `product_category_attributes`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `product_category_attributes`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `product_category_attributes` (
|
|
||||||
`id` char(36) NOT NULL,
|
|
||||||
`name` varchar(255) NOT NULL,
|
|
||||||
`product_category_id` char(36) DEFAULT NULL,
|
|
||||||
`attribute_type_id` int(11) NOT NULL,
|
|
||||||
`enabled` tinyint(1) NOT NULL,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `BY_NAME_AND_PRODUCT_CATEGORY_ID_UNIQUE` (`name`,`product_category_id`),
|
|
||||||
KEY `BY_PRODUCT_CATEGORY_ID` (`product_category_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `product_category_attributes`
|
|
||||||
--
|
|
||||||
|
|
||||||
LOCK TABLES `product_category_attributes` WRITE;
|
|
||||||
/*!40000 ALTER TABLE `product_category_attributes` DISABLE KEYS */;
|
|
||||||
INSERT INTO `product_category_attributes` VALUES ('bffebec4-2533-45b9-8f4e-e9169f5143d4','AWG','4',1,1);
|
|
||||||
/*!40000 ALTER TABLE `product_category_attributes` ENABLE KEYS */;
|
|
||||||
UNLOCK TABLES;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `product_category_attribute_options`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `product_category_attribute_options`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `product_category_attribute_options` (
|
|
||||||
`id` char(36) NOT NULL,
|
|
||||||
`product_category_attribute_id` char(36) NOT NULL,
|
|
||||||
`attribute_value` varchar(255) NOT NULL,
|
|
||||||
`attribute_label` varchar(255) NOT NULL,
|
|
||||||
`enabled` tinyint(1) NOT NULL DEFAULT 1,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `BY_PRODUCT_CATEGORY_ATTRIBUTE_ID` (`product_category_attribute_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `product_category_attribute_options`
|
|
||||||
--
|
|
||||||
|
|
||||||
LOCK TABLES `product_category_attribute_options` WRITE;
|
|
||||||
/*!40000 ALTER TABLE `product_category_attribute_options` DISABLE KEYS */;
|
|
||||||
INSERT INTO `product_category_attribute_options` VALUES ('0a19dbc8-b09b-4843-8955-3c1a9c94de27','bffebec4-2533-45b9-8f4e-e9169f5143d4','8','8',1),('1d7705d0-e4a8-4b88-ad86-b021493a6191','bffebec4-2533-45b9-8f4e-e9169f5143d4','10','10',1),('49d79d68-62ac-4dae-8757-4b4e31f00f26','bffebec4-2533-45b9-8f4e-e9169f5143d4','12','12',1),('6fb40b3d-ec9f-4ad0-b21a-26de0769e10c','bffebec4-2533-45b9-8f4e-e9169f5143d4','14','14',1),('871df26a-8d91-425c-8f94-ac450323674f','bffebec4-2533-45b9-8f4e-e9169f5143d4','4','4',1),('87a465f3-5c4c-4c1b-9dd2-d5c08831386d','bffebec4-2533-45b9-8f4e-e9169f5143d4','16','16',1),('9efa9fce-cdcd-43ae-a6cc-c8fb4076690e','bffebec4-2533-45b9-8f4e-e9169f5143d4','6','6',1),('bebc8041-4502-4a3e-a452-ee41a1c6890e','bffebec4-2533-45b9-8f4e-e9169f5143d4','20','20',1),('dd21c817-670b-4118-9dcb-e9e88ffc8c86','bffebec4-2533-45b9-8f4e-e9169f5143d4','18','18',1);
|
|
||||||
/*!40000 ALTER TABLE `product_category_attribute_options` ENABLE KEYS */;
|
|
||||||
UNLOCK TABLES;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `products`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `products`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `products` (
|
|
||||||
`id` char(36) NOT NULL,
|
|
||||||
`name` varchar(255) NOT NULL,
|
|
||||||
`product_category_id` char(36) NOT NULL,
|
|
||||||
`product_type_id` int(11) NOT NULL,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
UNIQUE KEY `BY_NAME_AND_CATEGORY_ID` (`product_category_id`,`name`),
|
|
||||||
KEY `product_category_id` (`product_category_id`),
|
|
||||||
KEY `product_type_id` (`product_type_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `products`
|
|
||||||
--
|
|
||||||
|
|
||||||
LOCK TABLES `products` WRITE;
|
|
||||||
/*!40000 ALTER TABLE `products` DISABLE KEYS */;
|
|
||||||
/*!40000 ALTER TABLE `products` ENABLE KEYS */;
|
|
||||||
UNLOCK TABLES;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Table structure for table `external_product_catalogs`
|
|
||||||
--
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `external_product_catalogs`;
|
|
||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
||||||
/*!40101 SET character_set_client = utf8 */;
|
|
||||||
CREATE TABLE `external_product_catalogs` (
|
|
||||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`product_catalog_id` char(36) NOT NULL,
|
|
||||||
`base_url` varchar(255) NOT NULL,
|
|
||||||
`api_url` varchar(255) NOT NULL,
|
|
||||||
`created` datetime NOT NULL,
|
|
||||||
`deleted` datetime DEFAULT NULL,
|
|
||||||
`enabled` tinyint(1) NOT NULL,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `BY_PRODUCT_CATALOG_ID` (`product_catalog_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Dumping data for table `external_product_catalogs`
|
|
||||||
--
|
|
||||||
|
|
||||||
LOCK TABLES `external_product_catalogs` WRITE;
|
|
||||||
/*!40000 ALTER TABLE `external_product_catalogs` DISABLE KEYS */;
|
|
||||||
/*!40000 ALTER TABLE `external_product_catalogs` ENABLE KEYS */;
|
|
||||||
UNLOCK TABLES;
|
|
||||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
|
||||||
|
|
||||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
|
||||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
|
||||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
|
||||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
|
||||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
|
||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
|
||||||
|
|
||||||
-- Dump completed on 2024-11-25 2:21:42
|
|
||||||
|
|
Loading…
Reference in New Issue