/** * @dataProvider getConfigDataProvider * @param bool $isRequired * @param integer $captchaGenerations * @param array $expectedConfig */ public function testGetConfig($isRequired, $captchaGenerations, $expectedConfig) { $this->captchaHelperMock->expects($this->any())->method('getCaptcha')->with($this->formId)->will($this->returnValue($this->captchaMock)); $this->captchaMock->expects($this->any())->method('isCaseSensitive')->will($this->returnValue(1)); $this->captchaMock->expects($this->any())->method('getHeight')->will($this->returnValue('12px')); $this->captchaMock->expects($this->any())->method('isRequired')->will($this->returnValue($isRequired)); $this->captchaMock->expects($this->exactly($captchaGenerations))->method('generate'); $this->captchaMock->expects($this->exactly($captchaGenerations))->method('getImgSrc')->will($this->returnValue('source')); $this->storeManagerMock->expects($this->any())->method('getStore')->will($this->returnValue($this->storeMock)); $this->storeMock->expects($this->once())->method('isCurrentlySecure')->will($this->returnValue(true)); $this->storeMock->expects($this->once())->method('getUrl')->with('captcha/refresh', ['_secure' => true])->will($this->returnValue('https://magento.com/captcha')); $config = $this->model->getConfig(); $this->assertEquals($config, $expectedConfig); }
/** * @param \Magento\Checkout\Block\Cart\Sidebar $subject * @param array $result * @return array * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterGetConfig(\Magento\Checkout\Block\Cart\Sidebar $subject, array $result) { return array_merge_recursive($result, $this->configProvider->getConfig()); }