public function testValidatorLogic()
 {
     $fail = new TestValidatorFail('fail!');
     $pass = new TestValidatorPass();
     $errors = new phTestValidatable();
     $logic = new phValidatorLogic($pass);
     $logic->and_($fail);
     $this->assertFalse($logic->validate('test', $errors), 'The and logic correctly fails');
     $logic = new phValidatorLogic($pass);
     $logic->or_($fail);
     $this->assertTrue($logic->validate('test', $errors), 'The or logic correctly passes');
     $logic = new phValidatorLogic($fail);
     $logic->or_($fail);
     $this->assertFalse($logic->validate('test', $errors), 'The or logic correctly fails');
     $logic = new phValidatorLogic($pass);
     $logic->and_($fail)->or_($pass);
     $this->assertTrue($logic->validate('test', $errors), 'The v and v or v logic correctly passes');
     $logic = new phValidatorLogic($fail);
     $logic->and_($fail);
     $errors->resetErrors();
     $logic->validate('test', $errors);
     $this->assertEquals(sizeof($errors->getErrors()), 2, 'The 2 fails messages where added');
 }
$errorMessage = array(phCompareValidator::INVALID => 'The event must occur sometime in January');
/*
 * setup a validator that says the datetime value given must be greater
 * or equal to the start of January 2011
 */
$start = new phCompareValidator(strtotime('2011-01-01 00:00:00'), phCompareValidator::GREATER_EQUAL, $errorMessage);
/*
 * setup a validator that says the datetime value given must be less
 * or equal to the end of January 2011
 */
$end = new phCompareValidator(strtotime('2011-01-31 23:59:59'), phCompareValidator::LESS_EQUAL, $errorMessage);
/*
 * combine the start and end validators so the date must be between
 * the two values
 */
$between = new phValidatorLogic($start);
$between->and_($end);
$timeForm->setValidator($between);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $form->bindAndValidate($_POST['event']);
    if ($form->isValid()) {
        /*
         * form data is valid, put your code to
         * register a new user here
         */
        echo "<h1>Thankyou! You chose the date: " . date('r', $form->time->getDateTime()) . "</h1>";
    }
}
?>
<form action="event.php" method="post">
	<?php