Skip to content

Commit

Permalink
Updated unit test classes to use the PHPUnit 9.x API.
Browse files Browse the repository at this point in the history
  • Loading branch information
allebb committed Dec 22, 2020
1 parent befccd6 commit 916b3c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions tests/MetarHttpClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;

/**
* Metar
Expand All @@ -11,11 +12,11 @@
*
* @author Bobby Allen <ballen@bobbyallen.me>
* @license http://www.gnu.org/licenses/gpl-3.0.html
* @link https://github.com/bobsta63/metar
* @link https://github.com/allebb/metar
* @link http://www.bobbyallen.me
*
*/
class MetarHttpClientTest extends \PHPUnit_Framework_TestCase
class MetarHttpClientTest extends TestCase
{

/**
Expand Down Expand Up @@ -57,7 +58,7 @@ public function testInvalidReport()
]);
$this->handler = HandlerStack::create($mock);
$client = new Ballen\Metar\Helpers\MetarHTTPClient(['handler' => $this->handler]);
$this->setExpectedException('Exception', 'Client error: `GET http://metar.vatsim.net/metar.php?id=EGSSA` resulted in a `404 Not Found` response');
$this->expectedException('Exception', 'Client error: `GET http://metar.vatsim.net/metar.php?id=EGSSA` resulted in a `404 Not Found` response');
$client->getMetarAPIResponse(sprintf(self::VATSIM_SERVICE_URL, 'EGSSA'));
}

Expand All @@ -71,7 +72,7 @@ public function testServiceUnavailableRepsonse()
]);
$this->handler = HandlerStack::create($mock);
$client = new Ballen\Metar\Helpers\MetarHTTPClient(['handler' => $this->handler]);
$this->setExpectedException('Exception', 'Server error: `GET http://metar.vatsim.net/metar.php?id=EGSS` resulted in a `502 Bad Gateway`');
$this->expectedException('Exception', 'Server error: `GET http://metar.vatsim.net/metar.php?id=EGSS` resulted in a `502 Bad Gateway`');
$client->getMetarAPIResponse(sprintf(self::VATSIM_SERVICE_URL, 'EGSS'));
}
}
9 changes: 5 additions & 4 deletions tests/MetarTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
use Ballen\Metar\Metar;
use PHPUnit\Framework\TestCase;

/**
* Metar
Expand All @@ -9,11 +10,11 @@
*
* @author Bobby Allen <ballen@bobbyallen.me>
* @license http://www.gnu.org/licenses/gpl-3.0.html
* @link https://github.com/bobsta63/metar
* @link https://github.com/allebb/metar
* @link http://www.bobbyallen.me
*
*/
class MetarTest extends \PHPUnit_Framework_TestCase
class MetarTest extends TestCase
{

/**
Expand All @@ -29,7 +30,7 @@ public function testSetValidIcao()
*/
public function testSetInvalidIcao()
{
$this->setExpectedException('InvalidArgumentException', 'ICAO code does not appear to be a valid format');
$this->expectedException('InvalidArgumentException', 'ICAO code does not appear to be a valid format');
$metar = new Metar('EGSSA');
}

Expand All @@ -48,7 +49,7 @@ public function testSetValidProvider()
public function testSetInvalidProvider()
{
$metar = new Metar('EGSS');
$this->setExpectedException('InvalidArgumentException', 'The service provider your specified does not exist in the namespace \'An_Invalid_Provider\'');
$this->expectedException('InvalidArgumentException', 'The service provider your specified does not exist in the namespace \'An_Invalid_Provider\'');
$metar->setProvider('An_Invalid_Provider');
}

Expand Down

0 comments on commit 916b3c6

Please sign in to comment.