18 $this->_objectManagerMock = $this->createMock(\
Magento\Framework\ObjectManagerInterface::class);
19 $this->_model = new \Magento\Captcha\Model\CaptchaFactory($this->_objectManagerMock);
24 $captchaType =
'default';
26 $defaultCaptchaMock = $this->createMock(\
Magento\Captcha\Model\DefaultModel::class);
28 $this->_objectManagerMock->expects(
33 $this->equalTo(
'Magento\Captcha\Model\\' . ucfirst($captchaType))
35 $this->returnValue($defaultCaptchaMock)
38 $this->assertEquals($defaultCaptchaMock, $this->_model->create($captchaType,
'form_id'));
43 $captchaType =
'wrong_instance';
45 $defaultCaptchaMock = $this->createMock(\stdClass::class);
47 $this->_objectManagerMock->expects(
52 $this->equalTo(
'Magento\Captcha\Model\\' . ucfirst($captchaType))
54 $this->returnValue($defaultCaptchaMock)
57 $this->expectException(
'InvalidArgumentException');
58 $this->expectExceptionMessage(
'Magento\Captcha\Model\\' . ucfirst($captchaType) .
59 ' does not implement \Magento\Captcha\Model\CaptchaInterface');
61 $this->assertEquals($defaultCaptchaMock, $this->_model->create($captchaType,
'form_id'));