Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pre_release-1.1.15' into pre_rel…
Browse files Browse the repository at this point in the history
…ease-1.1.15
  • Loading branch information
Santiagoebizmarts committed Feb 18, 2019
2 parents 1c0c61d + ba37f29 commit c1ac44c
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
3 changes: 1 addition & 2 deletions app/code/community/Ebizmarts/MailChimp/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,9 @@ public function addOrderViewMonkey(Varien_Event_Observer $observer)
$order = $block->getOrder();
$storeId = $order->getStoreId();
$helper = $this->makeHelper();
$addColumnConfig = $helper->getMonkeyInGrid($storeId);
$ecommEnabled = $helper->isEcomSyncDataEnabled($storeId);

if ($ecommEnabled && $addColumnConfig) {
if ($ecommEnabled) {
$transport = $observer->getTransport();
if ($transport) {
$html = $transport->getHtml();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1057,5 +1057,59 @@ public function testHandleCustomerGroupsIsNotSubcribedFromFrontEnd()

$mailchimpObserverMock->handleCustomerGroups($subscriberEmail, $params, $storeId, $customerId);
}

public function testAddOrderViewMonkey()
{
$html = '';
$storeId = 1;

$mailchimpObserverMock = $this->getMockBuilder(Ebizmarts_MailChimp_Model_Observer::class)
->setMethods(array('makeHelper'))
-> getMock();

$helperMock = $this->getMockBuilder(Ebizmarts_MailChimp_Helper_Data::class)
->setMethods(array('isEcomSyncDataEnabled'))
->getMock();

$observerMock = $this->getMockBuilder(Varien_Event_Observer::class)
->setMethods(array('getBlock', 'getTransport'))
->getMock();

$blockMock = $this->getMockBuilder(Mage_Core_Block_Abstract::class)
->setMethods(array('getNameInLayout', 'getOrder', 'getChild'))
->getMock();

$transportMock = $this->getMockBuilder(Varien_Event::class)
->setMethods(array('getHtml', 'setHtml'))
->getMock();

$orderMock = $this->getMockBuilder(Mage_Sales_Model_Order::class)
->setMethods(array('getStoreId'))
->getMock();

$childMock = $this->getMockBuilder(Mage_Core_Helper_String::class)
->setMethods(array('toHtml'))
->getMock();

$mailchimpObserverMock->expects($this->once())->method('makeHelper')->willReturn($helperMock);

$helperMock->expects($this->once())->method('isEcomSyncDataEnabled')->with($storeId)->willReturn(true);

$observerMock->expects($this->once())->method('getBlock')->willReturn($blockMock);
$observerMock->expects($this->once())->method('getTransport')->willReturn($transportMock);

$blockMock->expects($this->once())->method('getNameInLayout')->willReturn('order_info');
$blockMock->expects($this->once())->method('getOrder')->willReturn($orderMock);
$blockMock->expects($this->once())->method('getChild')->with('mailchimp.order.info.monkey.block')->willReturn($childMock);

$transportMock->expects($this->once())->method('getHtml')->willReturn($html);
$transportMock->expects($this->once())->method('setHtml')->with($html);

$orderMock->expects($this->once())->method('getStoreId')->willReturn($storeId);

$childMock->expects($this->once())->method('toHtml')->willReturn($html);

$mailchimpObserverMock->addOrderViewMonkey($observerMock);
}
}

0 comments on commit c1ac44c

Please sign in to comment.