Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Santiagoebizmarts committed Jan 21, 2020
1 parent 5066ca4 commit 55ed06f
Showing 1 changed file with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public function testGetNewPromoRuleWithError($promoRuleData)
{
$mailchimpStoreId = 'a1s2d3f4g5h6j7k8l9n0';
$magentoStoreId = 1;
$date = '2020-01-21 09:00:00';
$ruleName = $promoRuleData['title'];
$ruleSimpleAction = 'by_percent';
$ruleIsActive = true;
Expand All @@ -235,9 +236,9 @@ public function testGetNewPromoRuleWithError($promoRuleData)
->disableOriginalConstructor()
->setMethods(
array(
'getPromoRule', '_updateSyncData', 'getHelper',
'getMailChimpDiscountAmount', 'getMailChimpType', 'getDateHelper',
'getMailChimpTarget', 'ruleIsNotCompatible', 'ruleHasMissingInformation'
'getPromoRule', '_updateSyncData', 'getHelper', 'getMailChimpDiscountAmount', 'getMailChimpType',
'getDateHelper', 'getMailChimpTarget', 'ruleIsNotCompatible', 'ruleHasMissingInformation',
'addSyncDataError'
)
)
->getMock();
Expand All @@ -246,9 +247,8 @@ public function testGetNewPromoRuleWithError($promoRuleData)
->disableOriginalConstructor()
->setMethods(
array(
'getRuleId', 'getName', 'getDescription',
'getFromDate', 'getToDate', 'getSimpleAction',
'getIsActive', 'setMailchimpSyncError'
'getRuleId', 'getName', 'getDescription', 'getFromDate', 'getToDate', 'getSimpleAction',
'getIsActive', 'setMailchimpSyncError', 'getMailchimpSyncError'
)
)
->getMock();
Expand All @@ -258,12 +258,12 @@ public function testGetNewPromoRuleWithError($promoRuleData)
->getMock();

$mailChimpDateHelperMock = $this->getMockBuilder(Ebizmarts_MailChimp_Helper_Date::class)
->setMethods(array('getDateMicrotime'))
->setMethods(array('getDateMicrotime', 'formatDate'))
->disableOriginalConstructor()
->getMock();

$promoRulesApiMock
->expects($this->exactly(2))
->expects($this->once())
->method('getHelper')
->willReturn($mailChimpHelperMock);

Expand Down Expand Up @@ -307,6 +307,17 @@ public function testGetNewPromoRuleWithError($promoRuleData)
$promoRuleMock->expects($this->once())->method('getSimpleAction')->willReturn($ruleSimpleAction);
$promoRuleMock->expects($this->once())->method('getIsActive')->willReturn($ruleIsActive);
$promoRuleMock->expects($this->once())->method('setMailchimpSyncError')->with($error);
$promoRuleMock->expects($this->once())->method('getMailchimpSyncError')->willReturn($error);

$mailChimpDateHelperMock->expects($this->once())
->method('formatDate')
->with(null, "Y-m-d H:i:s")
->willReturn($date);

$promoRulesApiMock->expects($this->once())
->method('addSyncDataError')
->with($promoRuleData['id'], $promoRuleData['error'], null, false, $date);


$return = $promoRulesApiMock->getNewPromoRule(self::PROMORULE_ID, $mailchimpStoreId, $magentoStoreId);

Expand Down

0 comments on commit 55ed06f

Please sign in to comment.