Skip to content

Test enhancement #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ composer.phar
composer.lock
vendor/
local/
build/
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
language: php

php:
- 5.5
# - 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- nightly

install:
- composer install --dev
- composer install
- mkdir -p build/logs

after_script:
Expand Down
737 changes: 0 additions & 737 deletions build/logs/clover.xml

This file was deleted.

4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
}
],
"require": {
"php": ">=5.5.0",
"php": ">=7.0",
"menarasolutions/geographer-data": "^0.1.0"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*",
"phpunit/phpunit": "^6|^7",
"codeclimate/php-test-reporter": "dev-master",
"illuminate/support": "5.*",
"menarasolutions/geographer-de": "0.*",
Expand Down
5 changes: 3 additions & 2 deletions tests/Geographer/Integration/CityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

namespace Tests;

use PHPUnit\Framework\TestCase;
use MenaraSolutions\Geographer\Earth;
use MenaraSolutions\Geographer\City;
use MenaraSolutions\Geographer\State;

class CityTest extends \PHPUnit_Framework_TestCase
class CityTest extends TestCase
{
/**
* Countries that don't have any big cities
Expand Down Expand Up @@ -51,7 +52,7 @@ public function most_states_of_all_countries_have_cities()
if (! in_array($country->getCode(), $this->emptyCountries)) {
//if ($citiesCount == 0) echo $country->getCode();
//if ($citiesCount == 0) echo count($country->getStates());
$this->assertTrue($citiesCount > 0);
$this->assertGreaterThan(0, $citiesCount);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Geographer/Integration/CountryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function can_fetch_states_for_all_countries()
$this->assertEquals(MemberCollection::class, get_class($states));
$this->assertTrue(is_array($states) || $states instanceof \ArrayObject);
$array = $country->toArray();
$this->assertTrue(is_array($array));
$this->assertInternalType('array', $array);
$this->assertArrayHasKey('code', $array);
$this->assertArrayHasKey('code3', $array);
$this->assertArrayHasKey('name', $array);
Expand Down
15 changes: 7 additions & 8 deletions tests/Geographer/Integration/EarthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@

use MenaraSolutions\Geographer\Collections\MemberCollection;
use MenaraSolutions\Geographer\Country;
use MenaraSolutions\Geographer\Exceptions\MisconfigurationException;
use MenaraSolutions\Geographer\Earth;

class EarthTest extends Test
{
const TOTAL_COUNTRIES = 249;

/**
* @test
*/
public function planet_class_loads_default_countries()
{
$earth = new Earth();
$countries = $earth->getCountries();
$this->assertTrue(is_array($countries->toArray()));
$this->assertEquals(self::TOTAL_COUNTRIES, count($countries));
$this->assertEquals(self::TOTAL_COUNTRIES, count($countries->toArray()));
$this->assertInternalType('array', $countries->toArray());
$this->assertCount(self::TOTAL_COUNTRIES, $countries);
$this->assertCount(self::TOTAL_COUNTRIES, $countries->toArray());
}

/**
Expand Down Expand Up @@ -58,7 +57,7 @@ public function can_find_a_country_by_code()
{
$earth = new Earth();
$russia = $earth->findOne(['code' => 'RU']);
$this->assertTrue($russia instanceof Country);
$this->assertInstanceOf(Country::class, $russia);
$this->assertEquals('RU', $russia->getCode());
}

Expand All @@ -75,7 +74,7 @@ public function can_get_country_lists_by_continents()
{
$continent = $earth->{'get' . $continent}();
$this->assertInstanceOf(MemberCollection::class, $continent);
$this->assertTrue(is_array($continent->toArray()));
$this->assertInternalType('array', $continent->toArray());
}
}

Expand All @@ -94,4 +93,4 @@ public function can_filter_the_countries()

$this->assertNotEquals($count, $countries->count());
}
}
}
10 changes: 5 additions & 5 deletions tests/Geographer/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

namespace Tests;

use MenaraSolutions\Geographer\Earth;
use PHPUnit\Framework\TestCase;

abstract class Test extends \PHPUnit_Framework_TestCase
abstract class Test extends TestCase
{
use AnalyzesPerformance;

/**
* @return void
*/
public function setUp()
protected function setUp()
{
$this->performanceHook();
parent::setUp();
Expand All @@ -20,9 +20,9 @@ public function setUp()
/**
* @return void
*/
public function tearDown()
protected function tearDown()
{
$this->performanceCheck();
parent::tearDown();
}
}
}