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') |
|
|
|
|
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
|
|
|
|
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.