minFraud PHP API v1.0.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\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->assertSame(
43             'объединяет государства',
44             $model->country->name,
45             'country name is in Russian'
46         );
47     }
48 
49     public function testTwoFallbacks()
50     {
51         $model = new Country($this->raw, array('ru', 'ja'));
52 
53         $this->assertSame(
54             null,
55             $model->continent->name,
56             'continent name is undef (no Russian or Japanese available)'
57         );
58 
59         $this->assertSame(
60             'объединяет государства',
61             $model->country->name,
62             'country name is in Russian'
63         );
64     }
65 
66     public function testNoFallbacks()
67     {
68         $model = new Country($this->raw, array('ja'));
69 
70         $this->assertSame(
71             null,
72             $model->continent->name,
73             'continent name is undef (no Japanese available) '
74         );
75 
76         $this->assertSame(
77             null,
78             $model->country->name,
79             'country name is undef (no Japanese available) '
80         );
81     }
82 }
83 
minFraud PHP API v1.0.0 API documentation generated by ApiGen