public function testCondition()
{
static $value = 42;
$validator = new Conditional(new \Jyxo\Input\Validator\IsInt());
$validator->addValidator(new \Jyxo\Input\Validator\LessThan($value));
$good = [$value - 1, (int) ($value / 2), sqrt($value), 'example', false, true];
$bad = [$value * 2, (string) ($value * 2), (double) ($value * 2)];
foreach ($good as $value) {
$this->assertTrue($validator->isValid($value), sprintf('Test of value %s should be true but is false.', $value));
}
foreach ($bad as $value) {
$this->assertFalse($validator->isValid($value), sprintf('Test of value %s should be false but is true.', $value));
}
}