function testMultipleInput() { $inp = new MultipleInput('aDate', array('year' => 'IntInput', 'month' => 'IntInput', 'day' => 'IntInput')); $from = array('aDateyear' => '2006'); $r = $inp->isGiven($from); $this->assertFalse($r); $this->assertSame(2006, $inp->getChildValue($from, 'year')); $r = $inp->checkInput($from); $this->assertTrue($r->is('EMPTY_INPUT')); $from = array('aDateyear' => '2006', 'aDatemonth' => '7'); $r = $inp->isGiven($from); $this->assertFalse($r); $from = array('aDateyear' => '2006', 'aDatemonth' => '7', 'aDateday' => '25'); $r = $inp->isGiven($from); $this->assertTrue($r); $r = $inp->checkInput($from); $this->assertTrue($r); $r = $inp->getValue($from); $this->assertTrue($r->is('MULTIPLE_INPUT_HANDLER_GET_VALUE_NYI')); $this->assertEquals('aDate', $inp->getName()); }
function DateTimeInput($prefix) { $values = array('_Date_Year' => 'IntInput', '_Date_Month' => 'IntInput', '_Date_Day' => 'IntInput', '_Time_Hour' => 'IntInput', '_Time_Minute' => 'IntInput'); parent::MultipleInput($prefix, $values); }
function checkInput($from) { $r = parent::checkInput($from); if (!isError($r)) { if ($this->getChildValue($from, '1') == $this->getChildValue($from, '2')) { return null; } else { return new Error('PASSWORDS_NOT_EQUAL'); } } else { return $r; } }