Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 7c51fc9

Browse files
author
Mateusz Gostański
committed
Updated Exceptions and Facade test to use PHPUnit env variables instead of basing on config file
1 parent dc74ea6 commit 7c51fc9

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

tests/ApiCallExceptionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ApiCallExceptionTest extends TestCase
1414
protected function setUp(): void
1515
{
1616
parent::setUp();
17-
$this->obj = new ApiCallException(config('api-client.base_url'), 'response');
17+
$this->obj = new ApiCallException(env('TEST_BASE_URL'), 'response');
1818
}
1919

2020
protected function getPackageProviders($app)

tests/ApiClientFacadeTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Grixu\ApiClient\ApiClient as ApiClientClass;
66
use Grixu\ApiClient\ApiClientFacade as ApiClient;
77
use Grixu\ApiClient\ApiClientServiceProvider;
8+
use Grixu\ApiClient\CallApi;
89
use Orchestra\Testbench\TestCase;
910

1011
class ApiClientFacadeTest extends TestCase
@@ -20,8 +21,16 @@ public function check_return_value()
2021
$obj = $this->app->factory('api-client');
2122
$this->assertEquals(ApiClientClass::class, get_class($obj()));
2223

23-
ApiClient::shouldReceive('make')->once()->andReturnNull();
24+
ApiClient::shouldReceive('make')->once()->andReturn(
25+
new CallApi(
26+
env('TEST_BASE_URL'),
27+
env('TEST_OAUTH'),
28+
env('TEST_CLIENT_ID'),
29+
env('TEST_CLIENT_KEY'),
30+
'test'
31+
)
32+
);
2433

25-
ApiClient::make(config('api-client.base_url'));
34+
ApiClient::make(env('TEST_BASE_URL'));
2635
}
2736
}

tests/TokenIssueExceptionTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
22

3-
43
namespace Grixu\ApiClient\Tests;
54

6-
75
use Grixu\ApiClient\ApiClientServiceProvider;
86
use Grixu\ApiClient\Exceptions\TokenIssueException;
97
use Illuminate\Support\Facades\Log;

0 commit comments

Comments
 (0)