associations saving many to many workign now catalogs

This commit is contained in:
2025-03-31 01:55:52 -07:00
parent 025017537f
commit 04d03bd0bf
4 changed files with 30 additions and 9 deletions

View File

@@ -47,7 +47,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
// $this->enableCsrfToken();
// $this->enableSecurityToken();
$this->disableErrorHandlerMiddleware();
$this->ExternalProductCatalogs = $this->getTableLocator()->get('ExternalProductCatalogs');
$this->ExternalProductCatalogs = $this->getTableLocator()->get('CakeProducts.ExternalProductCatalogs');
}
/**
@@ -149,6 +149,7 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
public function testAddPostSuccess(): void
{
$cntBefore = $this->ExternalProductCatalogs->find()->count();
$linksBefore = $this->ExternalProductCatalogs->ExternalProductCatalogsProductCatalogs->find()->count();
$this->loginUserByRole('admin');
$url = [
@@ -160,13 +161,19 @@ class ExternalProductCatalogsControllerTest extends BaseControllerTest
'base_url' => 'http://localhost:8766',
'api_url' => 'http://localhost:8766/api/v1/',
'enabled' => true,
'external_product_catalogs_product_catalogs' => [
['product_catalog_id' => '115153f3-2f59-4234-8ff8-e1b205761428'],
]
];
$this->post($url, $data);
$this->assertResponseCode(302);
$this->assertRedirectContains('external-product-catalogs');
$cntAfter = $this->ExternalProductCatalogs->find()->count();
$linksAfter = $this->ExternalProductCatalogs->ExternalProductCatalogsProductCatalogs->find()->count();
$this->assertEquals($cntBefore + 1, $cntAfter);
$this->assertEquals($linksBefore + 1, $linksAfter);
}
/**