1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
/** |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace CommerceLeague\ActiveCampaign\Test\Unit\Model; |
7
|
|
|
|
8
|
|
|
use CommerceLeague\ActiveCampaign\Api\Data\AbandonedInterface; |
9
|
|
|
use CommerceLeague\ActiveCampaign\Model\Abandoned; |
10
|
|
|
use CommerceLeague\ActiveCampaign\Model\ResourceModel\Abandoned as AbandonedResource; |
11
|
|
|
use Magento\Framework\Model\Context; |
12
|
|
|
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; |
13
|
|
|
use PHPUnit\Framework\MockObject\MockObject; |
14
|
|
|
use PHPUnit\Framework\TestCase; |
15
|
|
|
|
16
|
|
|
class AbandonedTest extends TestCase |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @var MockObject|Context |
20
|
|
|
*/ |
21
|
|
|
protected $context; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var MockObject|AbandonedResource |
25
|
|
|
*/ |
26
|
|
|
protected $resource; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var Abandoned |
30
|
|
|
*/ |
31
|
|
|
protected $abandoned; |
32
|
|
|
|
33
|
|
|
protected function setUp() |
34
|
|
|
{ |
35
|
|
|
$this->context = $this->createMock(Context::class); |
36
|
|
|
$this->resource = $this->createMock(AbandonedResource::class); |
37
|
|
|
|
38
|
|
|
$this->abandoned = (new ObjectManager($this))->getObject( |
39
|
|
|
Abandoned::class, |
40
|
|
|
[ |
41
|
|
|
'context' => $this->context, |
42
|
|
|
'resource' => $this->resource |
43
|
|
|
] |
44
|
|
|
); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function testGetId() |
48
|
|
|
{ |
49
|
|
|
$entityId = 123; |
50
|
|
|
$this->abandoned->setData(AbandonedInterface::ENTITY_ID, $entityId); |
51
|
|
|
$this->assertEquals($entityId, $this->abandoned->getId()); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function testSetId() |
55
|
|
|
{ |
56
|
|
|
$entityId = 123; |
57
|
|
|
$this->abandoned->setId($entityId); |
58
|
|
|
$this->assertEquals($entityId, $this->abandoned->getData(AbandonedInterface::ENTITY_ID)); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function testSetQuoteId() |
62
|
|
|
{ |
63
|
|
|
$quoteId = 123; |
64
|
|
|
$this->abandoned->setData(AbandonedInterface::QUOTE_ID, $quoteId); |
65
|
|
|
$this->assertEquals($quoteId, $this->abandoned->getQuoteId()); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function testGetQuoteId() |
69
|
|
|
{ |
70
|
|
|
$quoteId = 123; |
71
|
|
|
$this->abandoned->setQuoteId($quoteId); |
72
|
|
|
$this->assertEquals($quoteId, $this->abandoned->getData(AbandonedInterface::QUOTE_ID)); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function testGetActiveCampaignId() |
76
|
|
|
{ |
77
|
|
|
$activeCampaignId = 123; |
78
|
|
|
$this->abandoned->setData(AbandonedInterface::ACTIVE_CAMPAIGN_ID, $activeCampaignId); |
79
|
|
|
$this->assertEquals($activeCampaignId, $this->abandoned->getActiveCampaignId()); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
public function testSetActiveCampaignId() |
83
|
|
|
{ |
84
|
|
|
$activeCampaignId = 123; |
85
|
|
|
$this->abandoned->setActiveCampaignId($activeCampaignId); |
86
|
|
|
$this->assertEquals($activeCampaignId, $this->abandoned->getData(AbandonedInterface::ACTIVE_CAMPAIGN_ID)); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function testGetCreatedAt() |
90
|
|
|
{ |
91
|
|
|
$createdAt = '2019-01-01 00:00:00'; |
92
|
|
|
$this->abandoned->setData(AbandonedInterface::CREATED_AT, $createdAt); |
93
|
|
|
$this->assertEquals($createdAt, $this->abandoned->getCreatedAt()); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public function testSetCreatedAt() |
97
|
|
|
{ |
98
|
|
|
$createdAt = '2019-01-01 00:00:00'; |
99
|
|
|
$this->abandoned->setCreatedAt($createdAt); |
100
|
|
|
$this->assertEquals($createdAt, $this->abandoned->getData(AbandonedInterface::CREATED_AT)); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function testGetUpdatedAt() |
104
|
|
|
{ |
105
|
|
|
$updatedAt = '2019-01-01 00:00:00'; |
106
|
|
|
$this->abandoned->setData(AbandonedInterface::UPDATED_AT, $updatedAt); |
107
|
|
|
$this->assertEquals($updatedAt, $this->abandoned->getUpdatedAt()); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
public function testSetUpdatedAt() |
111
|
|
|
{ |
112
|
|
|
$updatedAt = '2019-01-01 00:00:00'; |
113
|
|
|
$this->abandoned->setUpdatedAt($updatedAt); |
114
|
|
|
$this->assertEquals($updatedAt, $this->abandoned->getData(AbandonedInterface::UPDATED_AT)); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
} |
118
|
|
|
|