00001 <?php 00008 class UTUrlRequest extends foUnitTestBase 00009 { 00010 public function doTest() 00011 { 00012 $this->_testGet(); 00013 $this->_testGetDateTime(); 00014 $this->_testGetBool(); 00015 $this->_testGetString(); 00016 $this->_testgetInt(); 00017 } 00018 00019 private function _testGet() 00020 { 00021 $this->setSectionLabel('get'); 00022 00023 eval($this->needFalse('UrlRequst::get("start")')); 00024 eval($this->needFalse('UrlRequst::isSetArg("start")')); 00025 00026 UrlRequst::setDefault('start', '2001-01-01'); 00027 eval($this->needTrue('UrlRequst::isSetArg("start")')); 00028 eval($this->needEqual('UrlRequst::get("start")', '"2001-01-01"')); 00029 eval($this->needDiff('UrlRequst::get("start")', '"2s001-01-01"')); 00030 } 00031 00032 private function _testGetDateTime() 00033 { 00034 $this->setSectionLabel('getDateTime'); 00035 00036 eval($this->needFalse('UrlRequst::getDateTime("startTime")')); 00037 eval($this->needFalse('UrlRequst::isSetArg("startTime")')); 00038 00039 UrlRequst::setDefault('startTime', '2001-01-01'); 00040 eval($this->needTrue('UrlRequst::isSetArg("startTime")')); 00041 eval($this->needDate('UrlRequst::getDateTime("startTime")')); 00042 } 00043 00044 private function _testGetBool() 00045 { 00046 $this->setSectionLabel('getBool'); 00047 00048 eval($this->needFalse('UrlRequst::getBool("enable")')); 00049 00050 UrlRequst::set('enable', 'false'); 00051 eval($this->needFalse('UrlRequst::getBool("enable")')); 00052 00053 UrlRequst::set('enable', 'nO'); 00054 eval($this->needFalse('UrlRequst::getBool("enable")')); 00055 00056 UrlRequst::set('enable', '0'); 00057 eval($this->needFalse('UrlRequst::getBool("enable")')); 00058 00059 UrlRequst::set('enable', 'FalSe'); 00060 eval($this->needFalse('UrlRequst::getBool("enable")')); 00061 00062 UrlRequst::set('enable', 'true'); 00063 eval($this->needTrue('UrlRequst::getBool("enable")')); 00064 00065 UrlRequst::set('enable', 'yes'); 00066 eval($this->needTrue('UrlRequst::getBool("enable")')); 00067 00068 UrlRequst::set('enable', '1'); 00069 eval($this->needTrue('UrlRequst::getBool("enable")')); 00070 00071 UrlRequst::set('enable', 'TruE'); 00072 eval($this->needTrue('UrlRequst::getBool("enable")')); 00073 } 00074 00075 private function _testGetString() 00076 { 00077 $this->setSectionLabel('getString'); 00078 00079 eval($this->needEmpty('UrlRequst::getString("string")', '""')); 00080 00081 UrlRequst::setDefault('string', 'That\'s it man, game over man, game over!'); 00082 eval($this->needEqual('UrlRequst::getString("string")', '"That\'s it man, game over man, game over!"')); 00083 00084 UrlRequst::setDefault('string', 'What the fuck are we gonna do now? What are we gonna do?'); 00085 eval($this->needEqual('UrlRequst::getString("string")', '"That\'s it man, game over man, game over!"')); 00086 00087 UrlRequst::set('string', 'Maybe we could build a fire, sing a couple of songs, huh?'); 00088 eval($this->needEqual('UrlRequst::getString("string")', '"Maybe we could build a fire, sing a couple of songs, huh?"')); 00089 } 00090 00091 private function _testgetInt() 00092 { 00093 $this->setSectionLabel('getInt'); 00094 00095 eval($this->needFalse('UrlRequst::getInt("number")')); 00096 00097 UrlRequst::set('number', 'asdfsdf'); 00098 eval($this->needFalse('UrlRequst::getInt("number")')); 00099 00100 UrlRequst::set('number', '123'); 00101 eval($this->needEqual('UrlRequst::getInt("number")', '"123"')); 00102 00103 UrlRequst::set('number', '123'); 00104 eval($this->needEqual('UrlRequst::getInt("number")', '123')); 00105 00106 UrlRequst::set('number', '123,34'); 00107 eval($this->needFalse('UrlRequst::getInt("number")', '123')); 00108 } 00109 } 00110 00111 ?>