Completed
Pull Request — master (#336)
by Stefan
05:11
created

MassImportTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 38
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Tests\ShopwarePlugins\Connect;
4
5
use Shopware\Connect\Struct\Product;
6
7
class MassImportTest extends ConnectTestHelper
8
{
9
    public function testHandleProductUpdates()
10
    {
11
        // pseudo verify SDK
12
        $conn = Shopware()->Db();
13
        $conn->delete('sw_connect_shop_config', array());
14
        $conn->insert('sw_connect_shop_config', array('s_shop' => '_self_', 's_config' => -1));
15
        $conn->insert('sw_connect_shop_config', array('s_shop' => '_last_update_', 's_config' => time()));
16
        $conn->insert('sw_connect_shop_config', array('s_shop' => '_categories_', 's_config' => serialize(array('/bücher' => 'Bücher'))));
17
    }
18
19
20
    public function _testMassImportProducts()
21
    {
22
        $commands = array();
23
        for ($i=0; $i<=60; $i++) {
24
            $product = $this->getProduct();
25
            $commands[$product->sourceId] = new \Shopware\Connect\Struct\Change\ToShop\InsertOrUpdate(array(
26
                'product' => $product,
27
                'revision' => time(),
28
            ));
29
        }
30
31
        $start = microtime(true);
32
        $this->dispatchRpcCall('products', 'toShop', array(
33
            $commands
34
        ));
35
36
        $end = microtime(true);
37
38
        $t = $end - $start;
39
40
        echo $t;
41
42
    }
43
44
}
45