Rename GeoIP2 => GeoIp2 for consistency
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Test\Model;
|
||||
namespace GeoIp2\Test\Model;
|
||||
|
||||
use GeoIP2\Model\Country;
|
||||
use GeoIp2\Model\Country;
|
||||
|
||||
class CountryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@@ -38,28 +38,28 @@ class CountryTest extends \PHPUnit_Framework_TestCase
|
||||
public function testObjects ()
|
||||
{
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Model\Country',
|
||||
'GeoIp2\Model\Country',
|
||||
$this->model,
|
||||
'minimal GeoIP2::Model::Country object'
|
||||
'minimal GeoIp2::Model::Country object'
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Continent',
|
||||
'GeoIp2\Record\Continent',
|
||||
$this->model->continent
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Country',
|
||||
'GeoIp2\Record\Country',
|
||||
$this->model->country
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Country',
|
||||
'GeoIp2\Record\Country',
|
||||
$this->model->registeredCountry
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\RepresentedCountry',
|
||||
'GeoIp2\Record\RepresentedCountry',
|
||||
$this->model->representedCountry
|
||||
);
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Traits',
|
||||
'GeoIp2\Record\Traits',
|
||||
$this->model->traits
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Test\Model;
|
||||
namespace GeoIp2\Test\Model;
|
||||
|
||||
use GeoIP2\Model\Country;
|
||||
use GeoIp2\Model\Country;
|
||||
|
||||
class NameTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@@ -46,7 +46,8 @@ class NameTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testTwoFallbacks() {
|
||||
public function testTwoFallbacks()
|
||||
{
|
||||
$model = new Country($this->raw, array('ru', 'ja'));
|
||||
|
||||
$this->assertEquals(
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Test\Model;
|
||||
namespace GeoIp2\Test\Model;
|
||||
|
||||
use GeoIP2\Model\Omni;
|
||||
use GeoIp2\Model\Omni;
|
||||
|
||||
class OmniTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@@ -72,60 +72,60 @@ class OmniTest extends \PHPUnit_Framework_TestCase
|
||||
$model = new Omni($raw, array('en'));
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Model\Omni',
|
||||
'GeoIp2\Model\Omni',
|
||||
$model,
|
||||
'GeoIP2\Model\Omni object'
|
||||
'GeoIp2\Model\Omni object'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\City',
|
||||
'GeoIp2\Record\City',
|
||||
$model->city,
|
||||
'$model->city'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Continent',
|
||||
'GeoIp2\Record\Continent',
|
||||
$model->continent,
|
||||
'$model->continent'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Country',
|
||||
'GeoIp2\Record\Country',
|
||||
$model->country,
|
||||
'$model->country'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Location',
|
||||
'GeoIp2\Record\Location',
|
||||
$model->location,
|
||||
'$model->location'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Country',
|
||||
'GeoIp2\Record\Country',
|
||||
$model->registeredCountry,
|
||||
'$model->registeredCountry'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\RepresentedCountry',
|
||||
'GeoIp2\Record\RepresentedCountry',
|
||||
$model->representedCountry,
|
||||
'$model->representedCountry'
|
||||
);
|
||||
|
||||
$subdivisions = $model->subdivisions;
|
||||
foreach ($subdivisions as $subdiv) {
|
||||
$this->assertInstanceOf('GeoIP2\Record\Subdivision', $subdiv);
|
||||
$this->assertInstanceOf('GeoIp2\Record\Subdivision', $subdiv);
|
||||
}
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Subdivision',
|
||||
'GeoIp2\Record\Subdivision',
|
||||
$model->mostSpecificSubdivision,
|
||||
'$model->mostSpecificSubdivision'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Traits',
|
||||
'GeoIp2\Record\Traits',
|
||||
$model->traits,
|
||||
'$model->traits'
|
||||
);
|
||||
@@ -150,43 +150,43 @@ class OmniTest extends \PHPUnit_Framework_TestCase
|
||||
$model = new Omni($raw, array('en'));
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Model\Omni',
|
||||
'GeoIp2\Model\Omni',
|
||||
$model,
|
||||
'GeoIP2\Model\Omni object with no data except traits.ipAddress'
|
||||
'GeoIp2\Model\Omni object with no data except traits.ipAddress'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\City',
|
||||
'GeoIp2\Record\City',
|
||||
$model->city,
|
||||
'$model->city'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Continent',
|
||||
'GeoIp2\Record\Continent',
|
||||
$model->continent,
|
||||
'$model->continent'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Country',
|
||||
'GeoIp2\Record\Country',
|
||||
$model->country,
|
||||
'$model->country'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Location',
|
||||
'GeoIp2\Record\Location',
|
||||
$model->location,
|
||||
'$model->location'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Country',
|
||||
'GeoIp2\Record\Country',
|
||||
$model->registeredCountry,
|
||||
'$model->registeredCountry'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\RepresentedCountry',
|
||||
'GeoIp2\Record\RepresentedCountry',
|
||||
$model->representedCountry,
|
||||
'$model->representedCountry'
|
||||
);
|
||||
@@ -198,13 +198,13 @@ class OmniTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Subdivision',
|
||||
'GeoIp2\Record\Subdivision',
|
||||
$model->mostSpecificSubdivision,
|
||||
'$model->mostSpecificSubdivision'
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Record\Traits',
|
||||
'GeoIp2\Record\Traits',
|
||||
$model->traits,
|
||||
'$model->traits'
|
||||
);
|
||||
@@ -234,7 +234,7 @@ class OmniTest extends \PHPUnit_Framework_TestCase
|
||||
$model = new Omni($raw, array('en'));
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Model\Omni',
|
||||
'GeoIp2\Model\Omni',
|
||||
$model,
|
||||
'no exception when Omni model gets raw data with unknown keys'
|
||||
);
|
||||
+15
-15
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace GeoIP2\Test\WebService;
|
||||
namespace GeoIp2\Test\WebService;
|
||||
|
||||
use GeoIP2\WebService\Client;
|
||||
use GeoIp2\WebService\Client;
|
||||
use Guzzle\Http\Client as GuzzleClient;
|
||||
use Guzzle\Http\Message\Response;
|
||||
use Guzzle\Plugin\Mock\MockPlugin;
|
||||
@@ -91,7 +91,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
$country = $this->client($this->getResponse('1.2.3.4'))
|
||||
->country('1.2.3.4');
|
||||
|
||||
$this->assertInstanceOf('GeoIP2\Model\Country', $country);
|
||||
$this->assertInstanceOf('GeoIp2\Model\Country', $country);
|
||||
|
||||
$this->assertEquals(
|
||||
42,
|
||||
@@ -155,7 +155,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
$omni = $this->client($this->getResponse('1.2.3.4'))
|
||||
->omni('1.2.3.4');
|
||||
|
||||
$this->assertInstanceOf('GeoIP2\Model\Omni', $omni);
|
||||
$this->assertInstanceOf('GeoIp2\Model\Omni', $omni);
|
||||
|
||||
$this->assertEquals(
|
||||
42,
|
||||
@@ -169,7 +169,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
$city = $this->client($this->getResponse('1.2.3.4'))
|
||||
->city('1.2.3.4');
|
||||
|
||||
$this->assertInstanceOf('GeoIP2\Model\City', $city);
|
||||
$this->assertInstanceOf('GeoIp2\Model\City', $city);
|
||||
}
|
||||
|
||||
public function testMe()
|
||||
@@ -177,14 +177,14 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
$client = $this->client($this->getResponse('me'));
|
||||
|
||||
$this->assertInstanceOf(
|
||||
'GeoIP2\Model\CityIspOrg',
|
||||
'GeoIp2\Model\CityIspOrg',
|
||||
$client->cityIspOrg('me'),
|
||||
'can set ip parameter to me'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException GeoIP2\Exception\GeoIP2Exception
|
||||
* @expectedException GeoIp2\Exception\GeoIp2Exception
|
||||
* @expectedExceptionMessage Received a 200 response for https://geoip.maxmind.com/geoip/v2.0/country/1.2.3.5 but did not receive a HTTP body.
|
||||
*/
|
||||
public function testNoBodyException()
|
||||
@@ -195,7 +195,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException GeoIP2\Exception\GeoIP2Exception
|
||||
* @expectedException GeoIp2\Exception\GeoIp2Exception
|
||||
* @expectedExceptionMessage Received a 200 response for https://geoip.maxmind.com/geoip/v2.0/country/2.2.3.5 but could not decode the response as JSON:
|
||||
*/
|
||||
public function testBadBodyException()
|
||||
@@ -207,7 +207,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
|
||||
/**
|
||||
* @expectedException GeoIP2\Exception\WebServiceException
|
||||
* @expectedException GeoIp2\Exception\WebServiceException
|
||||
* @expectedExceptionCode 400
|
||||
* @expectedExceptionMessage The value "1.2.3" is not a valid ip address
|
||||
*/
|
||||
@@ -220,7 +220,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException GeoIP2\Exception\HttpException
|
||||
* @expectedException GeoIp2\Exception\HttpException
|
||||
* @expectedExceptionCode 400
|
||||
* @expectedExceptionMessage with no body
|
||||
*/
|
||||
@@ -232,7 +232,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException GeoIP2\Exception\GeoIP2Exception
|
||||
* @expectedException GeoIp2\Exception\GeoIp2Exception
|
||||
* @expectedExceptionMessage Response contains JSON but it does not specify code or error keys
|
||||
*/
|
||||
public function testWeirdErrorBodyIPException()
|
||||
@@ -244,7 +244,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException GeoIP2\Exception\HttpException
|
||||
* @expectedException GeoIp2\Exception\HttpException
|
||||
* @expectedExceptionCode 400
|
||||
* @expectedExceptionMessage did not include the expected JSON body
|
||||
*/
|
||||
@@ -257,7 +257,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException GeoIP2\Exception\HttpException
|
||||
* @expectedException GeoIp2\Exception\HttpException
|
||||
* @expectedExceptionCode 500
|
||||
* @expectedExceptionMessage Received a server error (500)
|
||||
*/
|
||||
@@ -270,7 +270,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException GeoIP2\Exception\HttpException
|
||||
* @expectedException GeoIp2\Exception\HttpException
|
||||
* @expectedExceptionCode 300
|
||||
* @expectedExceptionMessage Received a very surprising HTTP status (300)
|
||||
*/
|
||||
@@ -283,7 +283,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException GeoIP2\Exception\HttpException
|
||||
* @expectedException GeoIp2\Exception\HttpException
|
||||
* @expectedExceptionCode 406
|
||||
* @expectedExceptionMessage Received a 406 error for https://geoip.maxmind.com/geoip/v2.0/country/1.2.3.12 with the following body: Cannot satisfy your Accept-Charset requirements
|
||||
*/
|
||||
+1
-1
@@ -4,4 +4,4 @@ if (!$loader = @include __DIR__.'/../vendor/autoload.php') {
|
||||
die('Project dependencies missing');
|
||||
}
|
||||
|
||||
$loader->add('GeoIP2\Test', __DIR__);
|
||||
$loader->add('GeoIp2\Test', __DIR__);
|
||||
|
||||
Reference in New Issue
Block a user