@@ -42,6 +42,11 @@ class AjaxLoginTest extends \PHPUnit_Framework_TestCase
42
42
*/
43
43
protected $ loginControllerMock ;
44
44
45
+ /**
46
+ * @var array
47
+ */
48
+ protected $ formIds ;
49
+
45
50
/**
46
51
* @var \Magento\Captcha\Model\Customer\Plugin\AjaxLogin
47
52
*/
@@ -67,19 +72,25 @@ protected function setUp()
67
72
->will ($ this ->returnValue ($ this ->requestMock ));
68
73
$ this ->captchaHelperMock ->expects ($ this ->once ())->method ('getCaptcha ' )
69
74
->with ('user_login ' )->will ($ this ->returnValue ($ this ->captchaMock ));
75
+ $ this ->formIds = ['user_login ' ];
70
76
71
77
$ this ->model = new \Magento \Captcha \Model \Customer \Plugin \AjaxLogin (
72
78
$ this ->captchaHelperMock ,
73
79
$ this ->sessionManagerMock ,
74
- $ this ->jsonFactoryMock
80
+ $ this ->jsonFactoryMock ,
81
+ $ this ->formIds
75
82
);
76
83
}
77
84
78
85
public function testAroundExecute ()
79
86
{
80
87
$ username = 'name ' ;
81
88
$ captchaString = 'string ' ;
82
- $ requestContent = json_encode (['username ' => $ username , 'captcha_string ' => $ captchaString ]);
89
+ $ requestContent = json_encode ([
90
+ 'username ' => $ username ,
91
+ 'captcha_string ' => $ captchaString ,
92
+ 'captcha_form_id ' => $ this ->formIds [0 ]
93
+ ]);
83
94
84
95
$ this ->requestMock ->expects ($ this ->once ())->method ('getContent ' )->will ($ this ->returnValue ($ requestContent ));
85
96
$ this ->captchaMock ->expects ($ this ->once ())->method ('isRequired ' )->with ($ username )
@@ -98,7 +109,11 @@ public function testAroundExecuteIncorrectCaptcha()
98
109
{
99
110
$ username = 'name ' ;
100
111
$ captchaString = 'string ' ;
101
- $ requestContent = json_encode (['username ' => $ username , 'captcha_string ' => $ captchaString ]);
112
+ $ requestContent = json_encode ([
113
+ 'username ' => $ username ,
114
+ 'captcha_string ' => $ captchaString ,
115
+ 'captcha_form_id ' => $ this ->formIds [0 ]
116
+ ]);
102
117
103
118
$ this ->requestMock ->expects ($ this ->once ())->method ('getContent ' )->will ($ this ->returnValue ($ requestContent ));
104
119
$ this ->captchaMock ->expects ($ this ->once ())->method ('isRequired ' )->with ($ username )
0 commit comments