Skip to content

Commit

Permalink
Add Support for Guzzle 7 (#15)
Browse files Browse the repository at this point in the history
* Improving tests

* Improving config to allow values from .env

* Allowing Guzzle 7

* Fixes StyleCI
  • Loading branch information
stephandesouza authored Oct 24, 2020
1 parent 3e70822 commit 7e77245
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
composer.phar
composer.lock
.DS_Store
.idea
.idea
.env
phpunit.xml
.phpunit.result.cache
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"php": ">=7.0.0",
"illuminate/support": "^5.2|^6|^7|^8",
"illuminate/contracts": "^5.2|^6|^7|^8",
"guzzlehttp/guzzle": "~6.0"
"guzzlehttp/guzzle": "~6.0|~7.0"
},
"require-dev": {
"mockery/mockery": "~1.0",
Expand Down
14 changes: 7 additions & 7 deletions config/whmcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@
|
*/

'auth_type' => 'password',
'auth_type' => env('WHMCS_AUTH_TYPE', 'password'),

'apiurl' => 'https://url.to.whmcs.tld/whmcs/includes/api.php',
'apiurl' => env('WHMCS_API_URL', 'https://url.to.whmcs.tld/whmcs/includes/api.php'),

'api' => [
'identifier' => 'YOUR_API_IDENTIFIER',
'secret' => 'YOUR_API_SECRET',
'identifier' => env('WHMCS_API_IDENTIFIER', 'YOUR_API_IDENTIFIER'),
'secret' => env('WHMCS_API_SECRET', 'YOUR_API_SECRET'),
],

'password' => [
'username' => 'YOUR_USERNAME',
'password' => 'YOUR_PASSWORD',
'username' => env('WHMCS_USERNAME', 'YOUR_USERNAME'),
'password' => env('WHMCS_PASSWORD', 'YOUR_PASSWORD'),
],

/*
Expand All @@ -46,5 +46,5 @@
|
*/

'responsetype' => 'json',
'responsetype' => env('WHMCS_RESPONSE_TYPE', 'json'),
];
File renamed without changes.
12 changes: 10 additions & 2 deletions tests/ServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ class ServiceProviderTest extends TestCase
/** @test */
public function ThrowAnExceptionIfConfigNotExist()
{
$this->app['config']->set('whmcs.username', '');
$this->app['config']->set('whmcs.password', '');
$this->app['config']->set('whmcs.password.username', '');
$this->app['config']->set('whmcs.password.password', '');

$this->expectException(\InvalidArgumentException::class);

// call random WHMCS API
Whmcs::GetProducts();
}

/** @test */
public function CanGetWhmcsProduct()
{
// call random WHMCS API
$result = Whmcs::GetProducts();
$this->assertNotNull($result);
}
}

0 comments on commit 7e77245

Please sign in to comment.