예제 #1
0
파일: IPTest.php 프로젝트: nnnnathann/piwik
 /**
  * @group Core
  * @group IP
  * @dataProvider getLastIpFromListTestData
  */
 public function testGetLastIpFromList($csv, $expected)
 {
     // without excluded IPs
     $this->assertEquals($expected, Piwik_IP::getLastIpFromList($csv));
     // with excluded Ips
     $this->assertEquals($expected, Piwik_IP::getLastIpFromList($csv . ', 10.10.10.10', array('10.10.10.10')));
 }
예제 #2
0
 function test_getLastIpFromList()
 {
     $tests = array('' => '', '127.0.0.1' => '127.0.0.1', ' 127.0.0.1 ' => '127.0.0.1', ' 192.168.1.1, 127.0.0.1' => '127.0.0.1', '192.168.1.1 ,127.0.0.1 ' => '127.0.0.1', '192.168.1.1,' => '');
     foreach ($tests as $csv => $expected) {
         // without excluded IPs
         $this->assertEqual(Piwik_IP::getLastIpFromList($csv), $expected);
         // with excluded Ips
         $this->assertEqual(Piwik_IP::getLastIpFromList($csv . ', 10.10.10.10', array('10.10.10.10')), $expected);
     }
 }