function testStringInput()
 {
     $inp = new StringInput('aString');
     $from = array();
     $r = $inp->checkInput($from);
     $this->assertTrue($r->is('EMPTY_INPUT'));
     $r = $inp->getValue($from);
     $this->assertTrue($r->is('EMPTY_INPUT'));
     $this->assertEquals('aString', $inp->getName());
     $from = array('aString' => '');
     $r = $inp->checkInput($from);
     $this->assertTrue($r->is('EMPTY_INPUT'));
     $from = array('aString' => 'testInput');
     $this->assertTrue($inp->isGiven($from));
     $r = $inp->getValue($from);
     $this->assertEquals('testInput', $r);
     $_POST = array('aString' => 'aValue');
     $this->assertEquals('aValue', $inp->getValue('POST'));
     $_GET = array('aString' => 'aValue');
     $this->assertEquals('aValue', $inp->getValue('GET'));
 }
 function checkInput($from)
 {
     $r = parent::checkInput($from);
     if (isError($r)) {
         return $r;
     }
     $value = $this->getValue($from);
     $AtChar = strpos($value, '@');
     $host = substr($value, $AtChar + 1);
     $user = substr($value, 0, $AtChar);
     $domain = substr($host, strpos($host, '.') + 1);
     $hostName = substr($host, 0, strpos($host, '.'));
     if (strlen($user) > 0 && strlen($hostName) > 0 && strlen($domain) >= 2) {
         return true;
     } else {
         return new Error('INVALID_EMAIL');
     }
 }