diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2019-11-18 10:08:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-18 10:08:16 +0300 |
commit | 60009312a44f1aa728a0f9f6f7e0a8a59068544d (patch) | |
tree | 2b037e8abdf08ed024946a6a841757162ea9443f /tests/PHPUnit/Integration | |
parent | 12011166e3934f1d76f2d183a63cfe2ff9bde8e6 (diff) |
Add product name, product category, product sku, product price segments (#15144)
* Add product category segment.
* Fix productCategory action, add productName, productSku, productPrice segments.
* Hide productCategory1...5 segments in UI/API.
* fix tests
* Do not select conversion items that are deleted in segments + fix bug in ecommerce item insert (do not fail whole insert if one duplicate primary key is found).
* update expected files
* Fix unit test.
Diffstat (limited to 'tests/PHPUnit/Integration')
-rw-r--r-- | tests/PHPUnit/Integration/Tracker/ModelTest.php | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/tests/PHPUnit/Integration/Tracker/ModelTest.php b/tests/PHPUnit/Integration/Tracker/ModelTest.php index 7023cd502f..b14c066afc 100644 --- a/tests/PHPUnit/Integration/Tracker/ModelTest.php +++ b/tests/PHPUnit/Integration/Tracker/ModelTest.php @@ -124,7 +124,7 @@ class ModelTest extends IntegrationTestCase public function test_createEcommerceItems_shouldNotFail_IfWritingSameItemTwice() { - $item = array(array( + $item = array( 'idsite' => '1', 'idvisitor' => 'test', 'server_time' => '2014-01-01 00:00:00', @@ -140,9 +140,44 @@ class ModelTest extends IntegrationTestCase 'price' => '10.00', 'quantity' => '1', 'deleted' => '0' - )); - $this->model->createEcommerceItems($item); - $this->model->createEcommerceItems($item); + ); + $item2 = [ + 'idsite' => '1', + 'idvisitor' => 'test', + 'server_time' => '2014-01-01 00:00:00', + 'idvisit' => '1', + 'idorder' => '12', + 'idaction_sku' => '2', + 'idaction_name' => '2', + 'idaction_category' => '3', + 'idaction_category2' => '4', + 'idaction_category3' => '5', + 'idaction_category4' => '6', + 'idaction_category5' => '7', + 'price' => '20.00', + 'quantity' => '1', + 'deleted' => '0' + ]; + $this->model->createEcommerceItems([$item]); + $this->model->createEcommerceItems([$item, $item2]); + + $itemsInDb = Db::fetchAll("SELECT idsite, HEX(idvisitor) as idvisitor, idorder, idaction_sku FROM " . Common::prefixTable('log_conversion_item')); + $expectedItemsInDb = [ + [ + 'idsite' => '1', + 'idvisitor' => '7465737400000000', + 'idorder' => '12', + 'idaction_sku' => '1', + ], + [ + 'idsite' => '1', + 'idvisitor' => '7465737400000000', + 'idorder' => '12', + 'idaction_sku' => '2', + ], + ]; + + $this->assertEquals($expectedItemsInDb, $itemsInDb); } private function assertLogActionTableContainsTestAction($idaction) |