Skip to content

Commit

Permalink
Use ::class where needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
bojanz committed Mar 31, 2019
1 parent 10bf703 commit 43e974b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion tests/AddressFormat/AddressFormatRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace CommerceGuys\Addressing\Tests\AddressFormat;

use CommerceGuys\Addressing\AddressFormat\AddressFormat;
use CommerceGuys\Addressing\AddressFormat\AddressFormatRepository;
use CommerceGuys\Addressing\AddressFormat\AdministrativeAreaType;
use CommerceGuys\Addressing\AddressFormat\LocalityType;
Expand All @@ -24,7 +25,7 @@ public function testGet()
$addressFormat = $addressFormatRepository->get('ES');
// Confirm that the right class has been returned, a known value has
// been successfully populated, and defaults have been merged.
$this->assertInstanceOf('CommerceGuys\Addressing\AddressFormat\AddressFormat', $addressFormat);
$this->assertInstanceOf(AddressFormat::class, $addressFormat);
$this->assertEquals('ES', $addressFormat->getCountryCode());
$this->assertEquals(AdministrativeAreaType::PROVINCE, $addressFormat->getAdministrativeAreaType());
$this->assertEquals(LocalityType::CITY, $addressFormat->getLocalityType());
Expand Down
7 changes: 4 additions & 3 deletions tests/Country/CountryRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace CommerceGuys\Addressing\Tests\Country;

use CommerceGuys\Addressing\Country\Country;
use CommerceGuys\Addressing\Country\CountryRepository;
use org\bovigo\vfs\vfsStream;

Expand Down Expand Up @@ -62,7 +63,7 @@ public function testGet($countryRepository)
{
// Explicit locale.
$country = $countryRepository->get('FR', 'es');
$this->assertInstanceOf('CommerceGuys\\Addressing\\Country\\Country', $country);
$this->assertInstanceOf(Country::class, $country);
$this->assertEquals('FR', $country->getCountryCode());
$this->assertEquals('Francia', $country->getName());
$this->assertEquals('FRA', $country->getThreeLetterCode());
Expand All @@ -72,14 +73,14 @@ public function testGet($countryRepository)

// Default locale, lowercase country code.
$country = $countryRepository->get('fr');
$this->assertInstanceOf('CommerceGuys\\Addressing\\Country\\Country', $country);
$this->assertInstanceOf(Country::class, $country);
$this->assertEquals('FR', $country->getCountryCode());
$this->assertEquals('Frankreich', $country->getName());
$this->assertEquals('de', $country->getLocale());

// Fallback locale.
$country = $countryRepository->get('FR', 'INVALID-LOCALE');
$this->assertInstanceOf('CommerceGuys\\Addressing\\Country\\Country', $country);
$this->assertInstanceOf(Country::class, $country);
$this->assertEquals('FR', $country->getCountryCode());
$this->assertEquals('France', $country->getName());
$this->assertEquals('en', $country->getLocale());
Expand Down
2 changes: 1 addition & 1 deletion tests/Country/CountryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CountryTest extends \PHPUnit_Framework_TestCase
*/
public function testMissingProperty()
{
$this->setExpectedException('\InvalidArgumentException', 'Missing required property "country_code".');
$this->setExpectedException(\InvalidArgumentException::class, 'Missing required property "country_code".');
$country = new Country([]);
}

Expand Down
7 changes: 4 additions & 3 deletions tests/Subdivision/SubdivisionRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace CommerceGuys\Addressing\Tests\Subdivision;

use CommerceGuys\Addressing\Subdivision\Subdivision;
use CommerceGuys\Addressing\Subdivision\SubdivisionRepository;
use org\bovigo\vfs\vfsStream;

Expand Down Expand Up @@ -90,7 +91,7 @@ public function testGet($subdivisionRepository)
$subdivision = $subdivisionRepository->get('SC', ['BR']);
$subdivisionChild = $subdivisionRepository->get('Abelardo Luz', ['BR', 'SC']);

$this->assertInstanceOf('CommerceGuys\Addressing\Subdivision\Subdivision', $subdivision);
$this->assertInstanceOf(Subdivision::class, $subdivision);
$this->assertEquals(null, $subdivision->getParent());
$this->assertEquals('BR', $subdivision->getCountryCode());
$this->assertEquals('pt', $subdivision->getLocale());
Expand All @@ -103,12 +104,12 @@ public function testGet($subdivisionRepository)
$children = $subdivision->getChildren();
$this->assertEquals($subdivisionChild, $children['Abelardo Luz']);

$this->assertInstanceOf('CommerceGuys\Addressing\Subdivision\Subdivision', $subdivisionChild);
$this->assertInstanceOf(Subdivision::class, $subdivisionChild);
$this->assertEquals('Abelardo Luz', $subdivisionChild->getCode());
// $subdivision contains the loaded children while $parent doesn't,
// so they can't be compared directly.
$parent = $subdivisionChild->getParent();
$this->assertInstanceOf('CommerceGuys\Addressing\Subdivision\Subdivision', $parent);
$this->assertInstanceOf(Subdivision::class, $parent);
$this->assertEquals($subdivision->getCode(), $parent->getCode());
}

Expand Down

0 comments on commit 43e974b

Please sign in to comment.