Skip to content

Commit

Permalink
Improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
alies-dev committed Feb 24, 2024
1 parent cc44de4 commit 505c25b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 31 deletions.
16 changes: 4 additions & 12 deletions tests/CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

class CacheTest extends TestCase
{
/**
* @test
*/
/** @test */
public function shouldReturnValidLocation()
{
$data = [
Expand All @@ -34,9 +32,7 @@ public function shouldReturnValidLocation()
$this->assertEquals($location->default, false);
}

/**
* @test
*/
/** @test */
public function shouldReturnInvalidLocation()
{
$cacheMock = Mockery::mock('Illuminate\Cache\CacheManager')
Expand All @@ -55,9 +51,7 @@ public function shouldReturnInvalidLocation()
$this->assertEquals($geo_ip->getCache()->get('81.2.69.142'), null);
}

/**
* @test
*/
/** @test */
public function shouldSetLocation()
{
$location = new \InteractionDesignFoundation\GeoIP\Location([
Expand All @@ -83,9 +77,7 @@ public function shouldSetLocation()
$this->assertEquals($geo_ip->getCache()->set('81.2.69.142', $location), null);
}

/**
* @test
*/
/** @test */
public function shouldFlushLocations()
{
$cacheMock = Mockery::mock('Illuminate\Cache\CacheManager')
Expand Down
12 changes: 3 additions & 9 deletions tests/GeoIPTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@

class GeoIPTest extends TestCase
{
/**
* @test
*/
/** @test */
public function shouldGetUSDCurrency()
{
$geo_ip = $this->makeGeoIP();

$this->assertEquals($geo_ip->getCurrency('US'), 'USD');
}

/**
* @test
*/
/** @test */
public function testGetService()
{
$geo_ip = $this->makeGeoIP([
Expand All @@ -32,9 +28,7 @@ public function testGetService()
$this->assertInstanceOf(\InteractionDesignFoundation\GeoIP\Contracts\ServiceInterface::class, $geo_ip->getService());
}

/**
* @test
*/
/** @test */
public function testGetCache()
{
$geo_ip = $this->makeGeoIP();
Expand Down
15 changes: 5 additions & 10 deletions tests/Services/MaxMindDatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@

class MaxMindDatabaseTest extends TestCase
{
/**
* @test
*/
/** @test */
public function shouldReturnConfigValue()
{
list($service, $config) = $this->getService();

$this->assertEquals($service->config('database_path'), $config['database_path']);
}

/**
* @test
*/
/** @test */
public function shouldReturnValidLocation()
{
list($service, $config) = $this->getService();
Expand All @@ -30,9 +26,7 @@ public function shouldReturnValidLocation()
$this->assertEquals($location->default, false);
}

/**
* @test
*/
/** @test */
public function shouldReturnInvalidLocation()
{
list($service, $config) = $this->getService();
Expand All @@ -46,7 +40,8 @@ public function shouldReturnInvalidLocation()
}
}

protected function getService()
/** @return list{\InteractionDesignFoundation\GeoIP\Contracts\ServiceInterface, array<string, mixed>} */
protected function getService(): array
{
$config = $this->getConfig()['services']['maxmind_database'];

Expand Down

0 comments on commit 505c25b

Please sign in to comment.