12 class DataTest extends \PHPUnit\Framework\TestCase
34 $this->scopeConfigMock = $this->getMockBuilder(\
Magento\Framework\
App\Config\ScopeConfigInterface::class)
35 ->disableOriginalConstructor()
37 $contextMock = $this->getMockBuilder(\
Magento\Framework\
App\Helper\Context::class)
38 ->disableOriginalConstructor()
40 $contextMock->expects($this->any())
41 ->method(
'getScopeConfig')
42 ->willReturn($this->scopeConfigMock);
44 $storeManagerMock = $this->getMockBuilder(\
Magento\Store\Model\StoreManagerInterface::class)
45 ->disableOriginalConstructor()
48 $appStateMock = $this->getMockBuilder(\
Magento\Framework\
App\State::class)
49 ->disableOriginalConstructor()
52 $pricingCurrencyMock = $this->getMockBuilder(\
Magento\Framework\Pricing\PriceCurrencyInterface::class)
53 ->disableOriginalConstructor()
56 $this->helper = new \Magento\Sales\Helper\Data(
63 $this->storeMock = $this->getMockBuilder(\
Magento\Sales\Model\Store::class)
64 ->disableOriginalConstructor()
74 \
Magento\Sales\Model\Order\Email\Container\OrderIdentity::XML_PATH_EMAIL_ENABLED,
78 $this->assertEquals($scopeConfigValue, $this->helper->canSendNewOrderConfirmationEmail($this->storeMock));
88 \
Magento\Sales\Model\Order\Email\Container\OrderIdentity::XML_PATH_EMAIL_ENABLED,
92 $this->assertEquals($scopeConfigValue, $this->helper->canSendNewOrderEmail($this->storeMock));
102 \
Magento\Sales\Model\Order\Email\Container\OrderCommentIdentity::XML_PATH_EMAIL_ENABLED,
106 $this->assertEquals($scopeConfigValue, $this->helper->canSendOrderCommentEmail($this->storeMock));
116 \
Magento\Sales\Model\Order\Email\Container\ShipmentIdentity::XML_PATH_EMAIL_ENABLED,
120 $this->assertEquals($scopeConfigValue, $this->helper->canSendNewShipmentEmail($this->storeMock));
130 \
Magento\Sales\Model\Order\Email\Container\ShipmentCommentIdentity::XML_PATH_EMAIL_ENABLED,
134 $this->assertEquals($scopeConfigValue, $this->helper->canSendShipmentCommentEmail($this->storeMock));
143 \
Magento\Sales\Model\Order\Email\Container\InvoiceIdentity::XML_PATH_EMAIL_ENABLED,
147 $this->assertEquals($scopeConfigValue, $this->helper->canSendNewInvoiceEmail($this->storeMock));
156 \
Magento\Sales\Model\Order\Email\Container\InvoiceCommentIdentity::XML_PATH_EMAIL_ENABLED,
160 $this->assertEquals($scopeConfigValue, $this->helper->canSendInvoiceCommentEmail($this->storeMock));
170 \
Magento\Sales\Model\Order\Email\Container\CreditmemoIdentity::XML_PATH_EMAIL_ENABLED,
174 $this->assertEquals($scopeConfigValue, $this->helper->canSendNewCreditmemoEmail($this->storeMock));
184 \
Magento\Sales\Model\Order\Email\Container\CreditmemoCommentIdentity::XML_PATH_EMAIL_ENABLED,
188 $this->assertEquals($scopeConfigValue, $this->helper->canSendCreditmemoCommentEmail($this->storeMock));
200 $this->scopeConfigMock->expects($this->once())
201 ->method(
'isSetFlag')
204 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE,
207 ->will($this->returnValue($returnValue));
testCanSendCreditmemoCommentEmail($scopeConfigValue)
testCanSendShipmentCommentEmail($scopeConfigValue)
testCanSendNewCreditmemoEmail($scopeConfigValue)
setupScopeConfigIsSetFlag($flagName, $returnValue)
testCanSendNewOrderEmail($scopeConfigValue)
testCanSendOrderCommentEmail($scopeConfigValue)
testCanSendNewInvoiceEmail($scopeConfigValue)
testCanSendInvoiceCommentEmail($scopeConfigValue)
testCanSendNewShipmentEmail($scopeConfigValue)
testCanSendNewOrderConfirmationEmail($scopeConfigValue)