Ejemplo n.º 1
0
 /**
  * @test
  */
 public function save_captcha_code_to_session()
 {
     $length = 3;
     $cap = new Captcha(CaptchaConfig::instance(array('stringLength' => $length)));
     ob_start();
     $cap->output();
     ob_end_clean();
     $this->assertTrue(isset($_SESSION['captcha_code']));
     $this->assertEquals($length, mb_strlen($_SESSION['captcha_code']));
 }
Ejemplo n.º 2
0
 /**
  * @test
  * @expectedException RuntimeException
  * @expectedExceptionMessage stringLength should be integer and more than 1
  */
 public function isValid_throws_RuntimeException_when_stringLength_is_negative()
 {
     CaptchaConfig::instance(array('stringLength' => -1))->isValid();
 }
Ejemplo n.º 3
0
<?php

session_start();
require_once 'vendor/autoload.php';
use Ackintosh\Captcha;
use Ackintosh\CaptchaConfig;
$cap = new Captcha(CaptchaConfig::instance());
$cap->output();