Skip to content

Commit

Permalink
Fixed namespace for Composer
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Ross committed Jun 1, 2015
1 parent e74970d commit d507cf0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"autoload": {
"psr-0": {
"OfflineCountryReverseGeocoder": "src/"
"DaveRoss\\OfflineCountryReverseGeocoder\\": "src"
}
}
}
2 changes: 2 additions & 0 deletions src/offline-country-reverse-geocoder.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace DaveRoss\OfflineCountryReverseGeocoder;

function countries_array() {

static $country_data;
Expand Down
22 changes: 11 additions & 11 deletions tests/php/CountryCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ class CountryCodeTests extends PHPUnit_Framework_TestCase {
function test_get_country() {

// Washington DC
$this->assertEquals( 'US', get_country( - 77.0164, 38.9047 ) );
$this->assertEquals( 'US', DaveRoss\OfflineCountryReverseGeocoder\get_country( - 77.0164, 38.9047 ) );

// Chicago
$this->assertEquals( 'US', get_country( - 87.6847, 41.8369 ) );
$this->assertEquals( 'US', DaveRoss\OfflineCountryReverseGeocoder\get_country( - 87.6847, 41.8369 ) );

// London
$this->assertEquals( 'GB', get_country( - 0.12750, 51.50722 ) );
$this->assertEquals( 'GB', DaveRoss\OfflineCountryReverseGeocoder\get_country( - 0.12750, 51.50722 ) );

// New Dehli
$this->assertEquals( 'IN', get_country( 77.12, 28.38 ) );
$this->assertEquals( 'IN', DaveRoss\OfflineCountryReverseGeocoder\get_country( 77.12, 28.38 ) );

// Sydney
$this->assertEquals( 'AU', get_country( 151.2073200, - 33.8678500 ) );
$this->assertEquals( 'AU', DaveRoss\OfflineCountryReverseGeocoder\get_country( 151.2073200, - 33.8678500 ) );

}

function test_invalid_latlong() {

$this->assertEmpty( get_country( 400, 38.9047 ) );
$this->assertEmpty( get_country( - 77.0164, 400 ) );
$this->assertEmpty( get_country( - 400, 38.9047 ) );
$this->assertEmpty( get_country( - 77.0164, - 400 ) );
$this->assertEmpty( DaveRoss\OfflineCountryReverseGeocoder\get_country( 400, 38.9047 ) );
$this->assertEmpty( DaveRoss\OfflineCountryReverseGeocoder\get_country( - 77.0164, 400 ) );
$this->assertEmpty( DaveRoss\OfflineCountryReverseGeocoder\get_country( - 400, 38.9047 ) );
$this->assertEmpty( DaveRoss\OfflineCountryReverseGeocoder\get_country( - 77.0164, - 400 ) );

$this->assertEmpty( get_country( 'ABC', 'DEF' ) );
$this->assertEmpty( get_country( array(), array() ) );
$this->assertEmpty( DaveRoss\OfflineCountryReverseGeocoder\get_country( 'ABC', 'DEF' ) );
$this->assertEmpty( DaveRoss\OfflineCountryReverseGeocoder\get_country( array(), array() ) );

}
}

0 comments on commit d507cf0

Please sign in to comment.