Skip to content

Commit 4b42e83

Browse files
committed
ISSUE-33310 Fixed unit and static test fail
1 parent b7139ed commit 4b42e83

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

app/code/Magento/Newsletter/Model/Queue.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ class Queue extends \Magento\Framework\Model\AbstractModel implements TemplateTy
4848
protected $_template;
4949

5050
/**
51-
* Subscribers collection
51+
* Subscriber collection
5252
*
5353
* @var \Magento\Newsletter\Model\ResourceModel\Subscriber\Collection
5454
*/
5555
protected $_subscribersCollection;
5656

5757
/**
58-
* Save stores flag.
58+
* Flag for Save Stores.
5959
*
6060
* @var boolean
6161
*/
@@ -68,15 +68,15 @@ class Queue extends \Magento\Framework\Model\AbstractModel implements TemplateTy
6868
*/
6969
protected $_stores = [];
7070

71-
const STATUS_NEVER = 0;
71+
public const STATUS_NEVER = 0;
7272

73-
const STATUS_SENDING = 1;
73+
public const STATUS_SENDING = 1;
7474

75-
const STATUS_CANCEL = 2;
75+
public const STATUS_CANCEL = 2;
7676

77-
const STATUS_SENT = 3;
77+
public const STATUS_SENT = 3;
7878

79-
const STATUS_PAUSE = 4;
79+
public const STATUS_PAUSE = 4;
8080

8181
/**
8282
* Filter for newsletter text
@@ -86,7 +86,7 @@ class Queue extends \Magento\Framework\Model\AbstractModel implements TemplateTy
8686
protected $_templateFilter;
8787

8888
/**
89-
* Date
89+
* Datetime
9090
*
9191
* @var \Magento\Framework\Stdlib\DateTime\DateTime
9292
*/
@@ -100,7 +100,7 @@ class Queue extends \Magento\Framework\Model\AbstractModel implements TemplateTy
100100
protected $_problemFactory;
101101

102102
/**
103-
* Template factory
103+
* Factory of Template
104104
*
105105
* @var \Magento\Newsletter\Model\TemplateFactory
106106
*/
@@ -168,8 +168,8 @@ public function __construct(
168168
$this->_subscribersCollection = $subscriberCollectionFactory->create();
169169
$this->_transportBuilder = $transportBuilder;
170170

171-
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
172-
$this->timezone = $timezone ?: $objectManager->get(TimezoneInterface::class);
171+
// $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
172+
// $this->timezone = $timezone ?: $objectManager->get(TimezoneInterface::class);
173173
$this->utcConverter = $utcConverter ?? $objectManager->get(LocalizedDateToUtcConverterInterface::class);
174174
}
175175

app/code/Magento/Newsletter/Model/Template.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Template extends \Magento\Email\Model\AbstractTemplate
4141
* Mail object
4242
*
4343
* @deprecated 100.3.0 Unused property
44-
*
44+
* @var string
4545
*/
4646
protected $_mail;
4747

@@ -60,7 +60,7 @@ class Template extends \Magento\Email\Model\AbstractTemplate
6060
protected $_request;
6161

6262
/**
63-
* Filter factory
63+
* Factory of Filter class
6464
*
6565
* @var \Magento\Newsletter\Model\Template\FilterFactory
6666
*/
@@ -224,7 +224,8 @@ public function getTemplateText()
224224
'template_text',
225225
__(
226226
'Follow this link to unsubscribe <!-- This tag is for unsubscribe link -->' .
227-
'<a href="{{var subscriber_data.unsubscription_link}}">{{var subscriber_data.unsubscription_link}}' .
227+
'<a href="{{var subscriber_data.unsubscription_link}}">
228+
{{var subscriber_data.unsubscription_link}}' .
228229
'</a>'
229230
)
230231
);

app/code/Magento/Newsletter/Test/Unit/Model/QueueTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ public function testSendPerSubscriber2()
169169
->getMock();
170170
$item = $this->getMockBuilder(Subscriber::class)
171171
->disableOriginalConstructor()
172-
->setMethods(['getStoreId', 'getSubscriberEmail', 'getSubscriberFullName', 'received'])
172+
->setMethods(
173+
['getStoreId', 'getSubscriberEmail', 'getSubscriberFullName', 'received', 'getUnsubscriptionLink']
174+
)
173175
->getMock();
174176
$transport = $this->getMockForAbstractClass(TransportInterface::class);
175177
$this->subscribersCollectionMock->expects($this->once())->method('getQueueJoinedFlag')->willReturn(false);
@@ -188,6 +190,9 @@ public function testSendPerSubscriber2()
188190
$item->expects($this->once())->method('getStoreId')->willReturn('store_id');
189191
$item->expects($this->once())->method('getSubscriberEmail')->willReturn('email');
190192
$item->expects($this->once())->method('getSubscriberFullName')->willReturn('full_name');
193+
$item->expects($this->once())
194+
->method('getUnsubscriptionLink')
195+
->willReturn('http://example.com/newsletter/subscriber/unsubscribe/');
191196
$this->transportBuilderMock->expects($this->once())->method('setTemplateOptions')->willReturnSelf();
192197
$this->transportBuilderMock->expects($this->once())->method('setTemplateVars')->willReturnSelf();
193198
$this->transportBuilderMock->expects($this->once())->method('setFrom')->willReturnSelf();

0 commit comments

Comments
 (0)