minFraud PHP API v1.3.0
  • Namespace
  • Class

Namespaces

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

Classes

  • GeoIp2\Database\Reader
  • GeoIp2\Model\AnonymousIp
  • 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

Exceptions

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