Redaxscript\Captcha::init PHP Method

init() public method

init the class
Since: 2.4.0
public init ( integer $mode = null )
$mode integer captcha operator mode
    public function init($mode = null)
    {
        if (is_numeric($mode)) {
            $this->_mode = $mode;
        } else {
            $this->_mode = Db::getSetting('captcha');
        }
        $this->_create();
    }

Usage Example

 /**
  * testMinus
  *
  * @since 2.2.0
  */
 public function testMinus()
 {
     /* setup */
     $captcha = new Captcha($this->_language);
     $captcha->init(3);
     /* actual */
     $actual = $captcha->getSolution();
     /* compare */
     $this->assertTrue(is_numeric($actual));
 }