uuids instead of int ids fore xternal product catalogs, test fixes, many to many working now
This commit is contained in:
@@ -19,13 +19,11 @@ class ExternalProductCatalogsFixture extends TestFixture
|
||||
{
|
||||
$this->records = [
|
||||
[
|
||||
'id' => 1,
|
||||
'product_catalog_id' => '115153f3-2f59-4234-8ff8-e1b205761428',
|
||||
'id' => '115153f3-2f59-4234-8ff8-e1b205769999',
|
||||
'base_url' => 'http://localhost:8766',
|
||||
'api_url' => 'http://localhost:8766/api',
|
||||
'created' => '2024-11-22 09:39:37',
|
||||
'deleted' => '2024-11-22 09:39:37',
|
||||
'enabled' => 1,
|
||||
],
|
||||
];
|
||||
parent::init();
|
||||
|
||||
@@ -18,7 +18,12 @@ class ExternalProductCatalogsProductCatalogsFixture extends TestFixture
|
||||
public function init(): void
|
||||
{
|
||||
$this->records = [
|
||||
|
||||
[
|
||||
'external_product_catalog_id' => '115153f3-2f59-4234-8ff8-e1b205769999',
|
||||
'product_catalog_id' => '115153f3-2f59-4234-8ff8-e1b205761428',
|
||||
'created' => '2024-11-22 09:39:37',
|
||||
'enabled' => false,
|
||||
],
|
||||
];
|
||||
parent::init();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeProducts.ExternalProductCatalogs',
|
||||
'plugin.CakeProducts.ExternalProductCatalogsProductCatalogs',
|
||||
'plugin.CakeProducts.ProductCatalogs',
|
||||
];
|
||||
|
||||
@@ -96,7 +97,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||
*/
|
||||
public function testViewGet(): void
|
||||
{
|
||||
$id = 1;
|
||||
$id = '115153f3-2f59-4234-8ff8-e1b205769999';
|
||||
$this->loginUserByRole('admin');
|
||||
$url = [
|
||||
'plugin' => 'CakeProducts',
|
||||
@@ -218,7 +219,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||
'plugin' => 'CakeProducts',
|
||||
'controller' => 'ExternalProductCatalogs',
|
||||
'action' => 'edit',
|
||||
1,
|
||||
'115153f3-2f59-4234-8ff8-e1b205769999',
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
@@ -237,7 +238,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||
public function testEditPutSuccess(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
$id = 1;
|
||||
$id = '115153f3-2f59-4234-8ff8-e1b205769999';
|
||||
$before = $this->ExternalProductCatalogs->get($id);
|
||||
$url = [
|
||||
'plugin' => 'CakeProducts',
|
||||
@@ -273,7 +274,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||
public function testEditPutFailure(): void
|
||||
{
|
||||
$this->loginUserByRole('admin');
|
||||
$id = 1;
|
||||
$id = '115153f3-2f59-4234-8ff8-e1b205769999';
|
||||
$before = $this->ExternalProductCatalogs->get($id);
|
||||
$url = [
|
||||
'plugin' => 'CakeProducts',
|
||||
@@ -313,7 +314,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
|
||||
'plugin' => 'CakeProducts',
|
||||
'controller' => 'ExternalProductCatalogs',
|
||||
'action' => 'delete',
|
||||
1,
|
||||
'115153f3-2f59-4234-8ff8-e1b205769999',
|
||||
];
|
||||
$this->delete($url);
|
||||
$this->assertResponseCode(302);
|
||||
|
||||
@@ -110,7 +110,7 @@ class ExternalProductCatalogsProductCatalogsControllerTest extends BaseControlle
|
||||
];
|
||||
$this->delete($url);
|
||||
$this->assertResponseCode(302);
|
||||
$this->assertRedirectContains('externalproductcatalogsproductcatalogs');
|
||||
$this->assertRedirectContains('external-product-catalogs');
|
||||
|
||||
$cntAfter = $this->ExternalProductCatalogsProductCatalogs->find()->count();
|
||||
$this->assertEquals($cntBefore - 1, $cntAfter);
|
||||
|
||||
@@ -3,6 +3,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace CakeProducts\Test\TestCase\Model\Table;
|
||||
|
||||
use Cake\ORM\Table;
|
||||
use Cake\TestSuite\TestCase;
|
||||
use CakeProducts\Model\Table\ExternalProductCatalogsTable;
|
||||
|
||||
@@ -14,7 +15,7 @@ class ExternalProductCatalogsTableTest extends TestCase
|
||||
/**
|
||||
* Test subject
|
||||
*
|
||||
* @var \CakeProducts\Model\Table\ExternalProductCatalogsTable
|
||||
* @var ExternalProductCatalogsTable
|
||||
*/
|
||||
protected $ExternalProductCatalogs;
|
||||
|
||||
@@ -25,6 +26,7 @@ class ExternalProductCatalogsTableTest extends TestCase
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeProducts.ExternalProductCatalogs',
|
||||
'plugin.CakeProducts.ExternalProductCatalogsProductCatalogs',
|
||||
'plugin.CakeProducts.ProductCatalogs',
|
||||
];
|
||||
|
||||
@@ -56,13 +58,14 @@ class ExternalProductCatalogsTableTest extends TestCase
|
||||
* TestInitialize method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeProducts\Model\Table\ExternalProductCatalogsTable::initialize()
|
||||
* @uses ExternalProductCatalogsTable::initialize
|
||||
*/
|
||||
public function testInitialize(): void
|
||||
{
|
||||
// verify all associations loaded
|
||||
$expectedAssociations = [
|
||||
'ProductCatalogs',
|
||||
'ExternalProductCatalogsProductCatalogs',
|
||||
];
|
||||
$associations = $this->ExternalProductCatalogs->associations();
|
||||
|
||||
@@ -87,7 +90,7 @@ class ExternalProductCatalogsTableTest extends TestCase
|
||||
* Test validationDefault method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeProducts\Model\Table\ExternalProductCatalogsTable::validationDefault()
|
||||
* @uses ExternalProductCatalogsTable::validationDefault
|
||||
*/
|
||||
public function testValidationDefault(): void
|
||||
{
|
||||
@@ -98,7 +101,7 @@ class ExternalProductCatalogsTableTest extends TestCase
|
||||
* Test buildRules method
|
||||
*
|
||||
* @return void
|
||||
* @uses \CakeProducts\Model\Table\ExternalProductCatalogsTable::buildRules()
|
||||
* @uses ExternalProductCatalogsTable::buildRules
|
||||
*/
|
||||
public function testBuildRules(): void
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ class ProductCatalogsTableTest extends TestCase
|
||||
*/
|
||||
protected array $fixtures = [
|
||||
'plugin.CakeProducts.ProductCatalogs',
|
||||
'plugin.CakeProducts.ExternalProductCatalogsProductCatalogs',
|
||||
'plugin.CakeProducts.ProductCategories',
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user