uuids instead of int ids fore xternal product catalogs, test fixes, many to many working now

This commit is contained in:
2025-03-31 01:30:09 -07:00
parent 4c65d23e2b
commit 025017537f
11 changed files with 43 additions and 31 deletions

View File

@@ -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);

View File

@@ -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);