Overview

Namespaces

  • GeoIp2
    • Database
    • Exception
    • Model
    • Record
    • Test
      • Database
      • Model
      • WebService
    • WebService
  • MaxMind
    • MinFraud
      • Model
  • PHP

Classes

  • GeoIp2\Database\Reader
  • GeoIp2\Model\AnonymousIp
  • GeoIp2\Model\Asn
  • GeoIp2\Model\City
  • GeoIp2\Model\ConnectionType
  • GeoIp2\Model\Country
  • GeoIp2\Model\Domain
  • GeoIp2\Model\Enterprise
  • GeoIp2\Model\Insights
  • GeoIp2\Model\Isp
  • GeoIp2\Record\AbstractPlaceRecord
  • GeoIp2\Record\AbstractRecord
  • GeoIp2\Record\City
  • GeoIp2\Record\Continent
  • GeoIp2\Record\Country
  • GeoIp2\Record\Location
  • GeoIp2\Record\MaxMind
  • GeoIp2\Record\Postal
  • GeoIp2\Record\RepresentedCountry
  • GeoIp2\Record\Subdivision
  • GeoIp2\Record\Traits
  • GeoIp2\Test\Database\ReaderTest
  • GeoIp2\Test\Model\CountryTest
  • GeoIp2\Test\Model\InsightsTest
  • GeoIp2\Test\Model\NameTest
  • GeoIp2\Test\WebService\ClientTest
  • GeoIp2\WebService\Client
  • MaxMind\MinFraud
  • MaxMind\MinFraud\Model\Address
  • MaxMind\MinFraud\Model\BillingAddress
  • MaxMind\MinFraud\Model\CreditCard
  • MaxMind\MinFraud\Model\Device
  • MaxMind\MinFraud\Model\Disposition
  • MaxMind\MinFraud\Model\Email
  • MaxMind\MinFraud\Model\Factors
  • MaxMind\MinFraud\Model\GeoIp2Country
  • MaxMind\MinFraud\Model\GeoIp2Location
  • MaxMind\MinFraud\Model\Insights
  • MaxMind\MinFraud\Model\IpAddress
  • MaxMind\MinFraud\Model\Issuer
  • MaxMind\MinFraud\Model\Score
  • MaxMind\MinFraud\Model\ScoreIpAddress
  • MaxMind\MinFraud\Model\ShippingAddress
  • MaxMind\MinFraud\Model\Subscores
  • MaxMind\MinFraud\Model\Warning

Interfaces

  • GeoIp2\ProviderInterface
  • JsonSerializable
  • Throwable

Exceptions

  • BadFunctionCallException
  • BadMethodCallException
  • Exception
  • GeoIp2\Exception\AddressNotFoundException
  • GeoIp2\Exception\AuthenticationException
  • GeoIp2\Exception\GeoIp2Exception
  • GeoIp2\Exception\HttpException
  • GeoIp2\Exception\InvalidRequestException
  • GeoIp2\Exception\OutOfQueriesException
  • InvalidArgumentException
  • LogicException
  • Overview
  • Namespace
  • Class
  1: <?php
  2: 
  3: namespace GeoIp2\Test\Model;
  4: 
  5: use GeoIp2\Model\Country;
  6: 
  7: /**
  8:  * @coversNothing
  9:  */
 10: class NameTest extends \PHPUnit_Framework_TestCase
 11: {
 12:     public $raw = [
 13:         'continent' => [
 14:             'code' => 'NA',
 15:             'geoname_id' => 42,
 16:             'names' => [
 17:                 'en' => 'North America',
 18:                 'zh-CN' => '北美洲',
 19:             ],
 20:         ],
 21:         'country' => [
 22:             'geoname_id' => 1,
 23:             'iso_code' => 'US',
 24:             'names' => [
 25:                 'en' => 'United States of America',
 26:                 'ru' => 'объединяет государства',
 27:                 'zh-CN' => '美国',
 28:             ],
 29:         ],
 30:         'traits' => [
 31:             'ip_address' => '1.2.3.4',
 32:         ],
 33:     ];
 34: 
 35:     public function testFallback()
 36:     {
 37:         $model = new Country($this->raw, ['ru', 'zh-CN', 'en']);
 38: 
 39:         $this->assertSame(
 40:             '北美洲',
 41:             $model->continent->name,
 42:             'continent name is in Chinese (no Russian available)'
 43:         );
 44: 
 45:         $this->assertTrue(
 46:             isset($model->continent->name),
 47:             'continent name is set'
 48:         );
 49: 
 50:         $this->assertNotEmpty(
 51:             $model->continent->name,
 52:             'continent name is not empty'
 53:         );
 54: 
 55:         $this->assertSame(
 56:             'объединяет государства',
 57:             $model->country->name,
 58:             'country name is in Russian'
 59:         );
 60:     }
 61: 
 62:     public function testTwoFallbacks()
 63:     {
 64:         $model = new Country($this->raw, ['ru', 'ja']);
 65: 
 66:         $this->assertSame(
 67:             null,
 68:             $model->continent->name,
 69:             'continent name is undef (no Russian or Japanese available)'
 70:         );
 71: 
 72:         $this->assertFalse(
 73:             isset($model->continent->name),
 74:             'continent name is not set'
 75:         );
 76: 
 77:         $this->assertEmpty(
 78:             $model->continent->name,
 79:             'continent name is empty'
 80:         );
 81: 
 82:         $this->assertSame(
 83:             'объединяет государства',
 84:             $model->country->name,
 85:             'country name is in Russian'
 86:         );
 87:     }
 88: 
 89:     public function testNoFallbacks()
 90:     {
 91:         $model = new Country($this->raw, ['ja']);
 92: 
 93:         $this->assertSame(
 94:             null,
 95:             $model->continent->name,
 96:             'continent name is undef (no Japanese available) '
 97:         );
 98: 
 99:         $this->assertSame(
100:             null,
101:             $model->country->name,
102:             'country name is undef (no Japanese available) '
103:         );
104:     }
105: }
106: 
minFraud PHP API v1.4.0 API documentation generated by ApiGen