test fixes for product skus add
This commit is contained in:
@@ -36,6 +36,24 @@ class ProductCategoryVariantOptionsFixture extends TestFixture
|
||||
'modified' => '2025-07-04 12:00:00',
|
||||
'enabled' => 1,
|
||||
],
|
||||
[
|
||||
'id' => '5a386e9f-6e7a-4ae7-9360-c8e529f78d25',
|
||||
'variant_value' => 'Blue',
|
||||
'variant_label' => null,
|
||||
'product_category_variant_id' => '5a386e9f-6e7a-4ae7-9360-c8e529f78d94',
|
||||
'created' => '2025-07-04 12:00:00',
|
||||
'modified' => '2025-07-04 12:00:00',
|
||||
'enabled' => 1,
|
||||
],
|
||||
[
|
||||
'id' => '5a386e9f-6e7a-4ae7-9360-c8e529f78d26',
|
||||
'variant_value' => 'Red',
|
||||
'variant_label' => null,
|
||||
'product_category_variant_id' => '5a386e9f-6e7a-4ae7-9360-c8e529f78d94',
|
||||
'created' => '2025-07-04 12:00:00',
|
||||
'modified' => '2025-07-04 12:00:00',
|
||||
'enabled' => 1,
|
||||
],
|
||||
];
|
||||
parent::init();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class BaseControllerTest extends TestCase
|
||||
{
|
||||
parent::setUp();
|
||||
$toCopy = PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'webroot' . DS . 'images' . DS . '2c386086-f4c5-4093-bea5-ee9c29479f58.png';
|
||||
$productsFolder = PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'webroot' . DS .
|
||||
$productsFolder = PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'webroot' . DS . 'uploads' . DS .
|
||||
'images' . DS . 'products' . DS . 'cfc98a9a-29b2-44c8-b587-8156adc05317';
|
||||
$newName = $productsFolder . DS . '2c386086-f4c5-4093-bea5-ee9c29479f58.png';
|
||||
if (file_exists($toCopy)) {
|
||||
|
||||
@@ -46,6 +46,8 @@ class ProductSkusControllerTest extends BaseControllerTest
|
||||
parent::setUp();
|
||||
// $this->enableCsrfToken();
|
||||
// $this->enableSecurityToken();
|
||||
$this->disableErrorHandlerMiddleware();
|
||||
|
||||
$config = $this->getTableLocator()->exists('ProductSkus') ? [] : ['className' => ProductSkusTable::class];
|
||||
$this->ProductSkus = $this->getTableLocator()->get('ProductSkus', $config);
|
||||
}
|
||||
@@ -127,6 +129,7 @@ class ProductSkusControllerTest extends BaseControllerTest
|
||||
'plugin' => 'CakeProducts',
|
||||
'controller' => 'ProductSkus',
|
||||
'action' => 'add',
|
||||
'cfc98a9a-29b2-44c8-b587-8156adc05317'
|
||||
];
|
||||
$this->get($url);
|
||||
$this->assertResponseCode(200);
|
||||
@@ -154,13 +157,16 @@ class ProductSkusControllerTest extends BaseControllerTest
|
||||
'plugin' => 'CakeProducts',
|
||||
'controller' => 'ProductSkus',
|
||||
'action' => 'add',
|
||||
'cfc98a9a-29b2-44c8-b587-8156adc05317',
|
||||
];
|
||||
$data = [
|
||||
'product_id' => 'cfc98a9a-29b2-44c8-b587-8156adc05317',
|
||||
'sku' => 'cfc98a9a-29b2-44c8-b587-8156adc05317',
|
||||
'barcode' => 'cfc98a9a-29b2-44c8-b587-8156adc05317',
|
||||
'price' => 1.5,
|
||||
'cost' => 1.5,
|
||||
0 => [
|
||||
'add' => '1',
|
||||
'sku' => 'cfc98a9a-29b2-44c8-b587-8156adc05317',
|
||||
'barcode' => 'cfc98a9a-29b2-44c8-b587-8156adc05317',
|
||||
'price' => 1.5,
|
||||
'cost' => 1.5,
|
||||
],
|
||||
];
|
||||
$this->post($url, $data);
|
||||
$this->assertResponseCode(302);
|
||||
@@ -189,13 +195,15 @@ class ProductSkusControllerTest extends BaseControllerTest
|
||||
'plugin' => 'CakeProducts',
|
||||
'controller' => 'ProductSkus',
|
||||
'action' => 'add',
|
||||
'cfc98a9a-29b2-44c8-b587-8156adc05317',
|
||||
];
|
||||
$data = [
|
||||
'product_id' => '999999999', //does not exist
|
||||
'sku' => 'cfc98a9a-29b2-44c8-b587-8156adc05317',
|
||||
'barcode' => 'cfc98a9a-29b2-44c8-b587-8156adc05317',
|
||||
'price' => 1.5,
|
||||
'cost' => 1.5,
|
||||
0 => [
|
||||
'sku' => '',
|
||||
'barcode' => 'cfc98a9a-29b2-44c8-b587-8156adc05317',
|
||||
'price' => 1.5,
|
||||
'cost' => 1.5,
|
||||
],
|
||||
];
|
||||
$this->post($url, $data);
|
||||
$this->assertResponseCode(200);
|
||||
|
||||
@@ -59,7 +59,7 @@ Configure::write('App', [
|
||||
Configure::write('debug', true);
|
||||
Configure::write('CakeProducts', [
|
||||
'photos' => [
|
||||
'directory' => PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'webroot' . DS . 'images' . DS . 'products' . DS,
|
||||
'directory' => PLUGIN_ROOT . DS . 'tests' . DS . 'test_app' . DS . 'webroot' . DS . 'uploads' . DS . 'images' . DS . 'products' . DS,
|
||||
],
|
||||
/**
|
||||
* internal CakeProducts settings - used in the source of truth/internal only system.
|
||||
|
||||
Reference in New Issue
Block a user