test fixes for product skus add
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user