Skip to content
This repository has been archived by the owner on Mar 6, 2022. It is now read-only.

Commit

Permalink
Update Failing Tests and update PR/3
Browse files Browse the repository at this point in the history
  • Loading branch information
bosunski committed Oct 4, 2019
1 parent edb7180 commit 7af9007
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"minimum-stability": "stable",
"require": {
"php": "^7.1.3",
"php": "^7.1.3|^7.2",
"psr/http-message": "^1.0",
"psr/cache": "^1.0",
"php-http/httplug": "1.0.0|2.0.0",
Expand Down
28 changes: 14 additions & 14 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/App/PaystackApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Http\Message\RequestFactory;
use Http\Message\StreamFactory;
use Illuminate\Container\Container;
use Illuminate\Contracts\Container\BindingResolutionException;
use ReflectionException;
use Xeviant\Paystack\Client;
use Xeviant\Paystack\Config as PaystackConfig;
Expand Down Expand Up @@ -192,7 +193,7 @@ public function makeApi(string $apiName): ApiInterface
{
try {
return $this->make($apiName);
} catch (ReflectionException $e) {
} catch (BindingResolutionException $e) {
throw new InvalidArgumentException(sprintf('Undefined API called: "%s', $apiName));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function api($name): ApiInterface
try {
return $this->app->makeApi($name);
} catch (InvalidArgumentException $e) {
throw new InvalidArgumentException($e->getMessage());
throw $e;
}
}

Expand Down
9 changes: 5 additions & 4 deletions test/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Xeviant\Paystack\Tests;

use Http\Client\HttpClient;
use Illuminate\Contracts\Container\BindingResolutionException;
use Xeviant\Paystack\Api\Balance;
use Xeviant\Paystack\Api\Bank;
use Xeviant\Paystack\Api\BulkCharges;
Expand All @@ -21,6 +22,8 @@
use Xeviant\Paystack\Api\TransferRecipients;
use Xeviant\Paystack\Api\Transfers;
use Xeviant\Paystack\Client;
use Xeviant\Paystack\Exception\BadMethodCallException;
use Xeviant\Paystack\Exception\InvalidArgumentException;

final class ClientTest extends TestCase
{
Expand Down Expand Up @@ -78,24 +81,22 @@ public function shouldMagicallyGetApiInstance($apiName, $class)

/**
* @test
* @expectedException \Xeviant\Paystack\Exception\InvalidArgumentException
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function shouldNotBeAbleToGetApiInstanceThatDoesntExits()
{
$this->expectException(InvalidArgumentException::class);
$client = new Client();
$client->api('this_doesnt_exist');
}

/**
* @test
* @expectedException \Xeviant\Paystack\Exception\BadMethodCallException
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function shouldNotBeAbleToGetMagicApiInstanceThatDoesntExits()
{
$this->expectException(BadMethodCallException::class);
$client = new Client();
$client->doesNotExist();
}
Expand Down

0 comments on commit 7af9007

Please sign in to comment.