Project

General

Profile

Feature #23072 » validIP-8082.diff

Administrator Admin, 2010-07-02 12:29

View differences:

/Users/phorax/Clients+/_TYPO3/typo3_src-svn/tests/t3lib/t3lib_divTest.php 2010-07-02 12:26:30.000000000 +0200
$this->assertTrue($mkdirResult);
$this->assertTrue($directoryCreated);
}
/**
* Checks if t3lib_div::validIP() return the correct boolean for valid IPs
*
* @test
* @see t3lib_div::validIP()
* @dataProvider checkValidIpValidIpProvider
*/
public function checkValidIpValidIp($ip) {
$this->assertTrue(t3lib_div::validIP($ip));
}
/**
* Checks if t3lib_div::validIP() return the correct boolean for invalid IPs
*
* @test
* @see t3lib_div::validIP()
* @dataProvider checkValidIpInvalidIpProvider
*/
public function checkValidIpInvalidIp($ip) {
$this->assertFalse(t3lib_div::validIP($ip));
}
/**
* DataProvider for checkValidIpValidIp
*
* @return Array
*/
public static function checkValidIpValidIpProvider() {
return array(
'0.0.0.0' => array('0.0.0.0'),
'private Ip v4 class C' => array('192.168.0.1'),
'private Ip v4 class A' => array('10.0.13.1'),
'private Ip v6' => array('fe80::daa2:5eff:fe8b:7dfb')
);
}
/**
* DataProvider for checkValidIpInvalidIp
*
* @return Array
*/
public static function checkValidIpInvalidIpProvider() {
return array(
'String' => array('test'),
'out of bounds' => array('300.300.300.300'),
'String null' => array('null'),
'localhost 127' => array('127.0.1'),
'null' => array(null),
'zero' => array(0),
'zero' => array('')
);
}
}
?>
(1-1/3)