validate() public method

public validate ( mixed $value ) : boolean
$value mixed
return boolean
 public function testRule()
 {
     $option = new Option('f');
     $option->setRule(function ($value) {
         return is_numeric($value);
     });
     $this->assertFalse($option->validate('a'));
     $this->assertFalse($option->validate('abc'));
     $this->assertTrue($option->validate('2'));
     $this->assertTrue($option->validate(2));
     $this->assertTrue($option->validate(0));
     $option->setValue(2);
     $caught = false;
     try {
         $option->setValue('abc');
     } catch (\Exception $e) {
         $caught = true;
     }
     $this->assertTrue($caught);
 }