Completed
Push — master ( cae295...8cff55 )
by
unknown
13:42
created

GuestCustomerStrategyTest::getStrategy()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 1
Metric Value
dl 0
loc 26
rs 8.8571
c 1
b 1
f 1
cc 1
eloc 18
nc 1
nop 0
1
<?php
2
3
namespace OroCRM\Bundle\MagentoBundle\Tests\Unit\ImportExport\Strategy;
4
5
use Oro\Bundle\IntegrationBundle\Entity\Channel;
6
use OroCRM\Bundle\MagentoBundle\Entity\Customer;
7
use OroCRM\Bundle\MagentoBundle\Entity\Store;
8
use OroCRM\Bundle\MagentoBundle\Entity\Website;
9
use OroCRM\Bundle\MagentoBundle\ImportExport\Strategy\GuestCustomerStrategy;
10
11
class GuestCustomerStrategyTest extends AbstractStrategyTest
12
{
13
    /**
14
     * @return GuestCustomerStrategy
15
     */
16
    protected function getStrategy()
17
    {
18
        $strategy = new GuestCustomerStrategy(
19
            $this->eventDispatcher,
20
            $this->strategyHelper,
21
            $this->fieldHelper,
22
            $this->databaseHelper,
23
            $this->chainEntityClassNameProvider,
24
            $this->translator
25
        );
26
27
        $strategy->setOwnerHelper($this->defaultOwnerHelper);
28
        $strategy->setChannelHelper($this->channelHelper);
29
30
        $this->databaseHelper->expects($this->any())->method('getEntityReference')
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Oro\Bundle\Import...e\Field\DatabaseHelper>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
31
            ->will($this->returnArgument(0));
32
33
        $strategy->setImportExportContext(
34
            $this->getMockBuilder('Oro\Bundle\ImportExportBundle\Context\ContextInterface')
35
            ->disableOriginalConstructor()
36
            ->getMock()
37
        );
38
        $strategy->setEntityName('OroCRM\Bundle\MagentoBundle\Entity\Customer');
39
40
        return $strategy;
41
    }
42
43
    public function testProcessEmptyEntity()
44
    {
45
        $customer = $this->getCustomer();
46
47
        $this->assertNotEmpty($this->getStrategy()->process($customer));
48
    }
49
50
    public function testProcessEntityWithStore()
51
    {
52
        $store = new Store();
53
        $store->setWebsite(new Website());
54
55
        $customer = $this->getCustomer();
56
        $customer->setStore($store);
57
58
        $this->assertNotEmpty($this->getStrategy()->process($customer));
59
    }
60
61
    /**
62
     * @return Customer
63
     */
64
    private function getCustomer()
65
    {
66
        $customer = new Customer();
67
        $customer->setChannel(new Channel());
68
69
        return $customer;
70
    }
71
}
72