30 $this->methodOneMock = $this->createPartialMock(
32 [
'isAvailable',
'getInstructions']
34 $this->methodTwoMock = $this->createPartialMock(
36 [
'isAvailable',
'getInstructions']
39 $paymentHelperMock = $this->createMock(\
Magento\
Payment\Helper\Data::class);
40 $paymentHelperMock->expects($this->exactly(2))
41 ->method(
'getMethodInstance')
47 $this->escaperMock = $this->createMock(\
Magento\Framework\Escaper::class);
48 $this->escaperMock->expects($this->any())
49 ->method(
'escapeHtml')
50 ->willReturnArgument(0);
66 public function testGetConfig($isOneAvailable, $instructionsOne, $isTwoAvailable, $instructionsTwo,
$result)
68 $this->methodOneMock->expects($this->once())
69 ->method(
'isAvailable')
70 ->willReturn($isOneAvailable);
71 $this->methodOneMock->expects($this->any())
72 ->method(
'getInstructions')
73 ->willReturn($instructionsOne);
75 $this->methodTwoMock->expects($this->once())
76 ->method(
'isAvailable')
77 ->willReturn($isTwoAvailable);
78 $this->methodTwoMock->expects($this->any())
79 ->method(
'getInstructions')
80 ->willReturn($instructionsTwo);
82 $this->assertEquals(
$result, $this->model->getConfig());
93 [
false,
'',
false,
'', []],
94 [
false,
'one',
false,
'two', []],
95 [
true,
'',
false,
'', [
'payment' => [
'instructions' => [$oneCode =>
'']]]],
96 [
true,
'text one',
false,
'', [
'payment' => [
'instructions' => [$oneCode =>
'text one']]]],
97 [
false,
'',
true,
'', [
'payment' => [
'instructions' => [$twoCode =>
'']]]],
98 [
false,
'',
true,
'text two', [
'payment' => [
'instructions' => [$twoCode =>
'text two']]]],
99 [
true,
'',
true,
'', [
'payment' => [
'instructions' => [$oneCode =>
'', $twoCode =>
'']]]],
105 [
'payment' => [
'instructions' => [$oneCode =>
'text one', $twoCode =>
'text two']]]
112 [
'payment' => [
'instructions' => [$oneCode =>
"<br />\n", $twoCode =>
"<br />\n"]]]
const PAYMENT_METHOD_BANKTRANSFER_CODE
testGetConfig($isOneAvailable, $instructionsOne, $isTwoAvailable, $instructionsTwo, $result)
const PAYMENT_METHOD_CASHONDELIVERY_CODE