Ejemplo n.º 1
0
 public function testPassingElementWithReCaptchaRendersCorrectly()
 {
     if (!constant('TESTS_ZEND_FORM_RECAPTCHA_SUPPORT')) {
         $this->markTestSkipped('Enable TESTS_ZEND_FORM_RECAPTCHA_SUPPORT to test PDF render');
     }
     $captcha = new Captcha\ReCaptcha(array('sessionClass' => 'ZendTest\\Captcha\\TestAsset\\SessionContainer'));
     $service = $captcha->getService();
     $service->setPublicKey($this->publicKey);
     $service->setPrivateKey($this->privateKey);
     $element = $this->getElement();
     $element->setCaptcha($captcha);
     $markup = $this->helper->render($element);
     $this->assertContains('foo-challenge', $markup);
     $this->assertContains('foo-response', $markup);
     $this->assertContains('foo[recaptcha_challenge_field]', $markup);
     $this->assertContains('foo[recaptcha_response_field]', $markup);
     $this->assertContains('zendBindEvent', $markup);
     $this->assertContains($service->getHtml('foo'), $markup);
 }
Ejemplo n.º 2
0
 /** @group ZF-7654 */
 public function testAllowsSettingThemeOptionOnServiceObject()
 {
     $captcha = new ReCaptcha();
     $captcha->setOption('theme', 'black');
     $this->assertEquals('black', $captcha->getService()->getOption('theme'));
 }
Ejemplo n.º 3
0
 public function testPassingElementWithReCaptchaRendersCorrectly()
 {
     $captcha = new Captcha\ReCaptcha(array('sessionClass' => 'ZendTest\\Captcha\\TestAsset\\SessionContainer'));
     $service = $captcha->getService();
     $service->setPublicKey($this->publicKey);
     $service->setPrivateKey($this->privateKey);
     $element = $this->getElement();
     $element->setCaptcha($captcha);
     $markup = $this->helper->render($element);
     $this->assertContains('foo-challenge', $markup);
     $this->assertContains('foo-response', $markup);
     $this->assertContains('foo[recaptcha_challenge_field]', $markup);
     $this->assertContains('foo[recaptcha_response_field]', $markup);
     $this->assertContains('zendBindEvent', $markup);
     $this->assertContains($service->getHtml('foo'), $markup);
 }