Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CheckmoTest.php
Go to the documentation of this file.
1 <?php
7 
8 class CheckmoTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $_object;
14 
18  protected $_scopeConfig;
19 
20  protected function setUp()
21  {
22  $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
23  $eventManager = $this->createMock(\Magento\Framework\Event\ManagerInterface::class);
24  $paymentDataMock = $this->createMock(\Magento\Payment\Helper\Data::class);
25  $this->_scopeConfig = $this->createPartialMock(
26  \Magento\Framework\App\Config\ScopeConfigInterface::class,
27  ['getValue', 'isSetFlag']
28  );
29  $this->_object = $objectManagerHelper->getObject(
30  \Magento\OfflinePayments\Model\Checkmo::class,
31  [
32  'eventManager' => $eventManager,
33  'paymentData' => $paymentDataMock,
34  'scopeConfig' => $this->_scopeConfig,
35  ]
36  );
37  }
38 
39  public function testGetPayableTo()
40  {
41  $this->_object->setStore(1);
42  $this->_scopeConfig->expects($this->once())
43  ->method('getValue')
44  ->with('payment/checkmo/payable_to', 'store', 1)
45  ->willReturn('payable');
46  $this->assertEquals('payable', $this->_object->getPayableTo());
47  }
48 
49  public function testGetMailingAddress()
50  {
51  $this->_object->setStore(1);
52  $this->_scopeConfig->expects($this->once())
53  ->method('getValue')
54  ->with('payment/checkmo/mailing_address', 'store', 1)
55  ->willReturn('[email protected]');
56  $this->assertEquals('[email protected]', $this->_object->getMailingAddress());
57  }
58 }