Exemplo n.º 1
0
 /**
  * @dataProvider testIsMethodAvailableDataProvider
  * @param bool $methodIsAvailable
  * @param bool $expected
  */
 public function testIsMethodAvailable($methodIsAvailable, $expected)
 {
     $methodInstance = $this->getMockBuilder('Magento\\Payment\\Model\\MethodInterface')->getMockForAbstractClass();
     $methodInstance->expects($this->any())->method('isAvailable')->will($this->returnValue($methodIsAvailable));
     $this->_paymentData->expects($this->any())->method('getMethodInstance')->will($this->returnValue($methodInstance));
     $this->assertEquals($expected, $this->helper->isMethodAvailable('payment_code'));
 }
Exemplo n.º 2
0
 /**
  * @dataProvider testIsMethodAvailableDataProvider
  * @param bool $methodExists
  * @param bool $methodIsAvailable
  * @param bool $expected
  */
 public function testIsMethodAvailable($methodExists, $methodIsAvailable, $expected)
 {
     $methodInstance = $this->getMock('MethodInstance', ['isAvailable']);
     $methodInstance->expects($this->any())->method('isAvailable')->will($this->returnValue($methodIsAvailable));
     $this->_paymentData->expects($this->any())->method('getMethodInstance')->will($this->returnValue($methodExists ? $methodInstance : false));
     $this->assertEquals($expected, $this->helper->isMethodAvailable('payment_code'));
 }