Skip to content

Commit

Permalink
Update ApiClientTest.php
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Aug 24, 2024
1 parent b365dbe commit 5aeafc0
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
namespace Test\Unit;

use GuzzleHttp\HandlerStack;
use Leantime\Core\Http\Client\ApiSession;
use Leantime\Core\Http\Client\ApiClient;
use PHPUnit\Framework\TestCase;

class ApiSessionTest extends TestCase
class ApiClientTest extends TestCase
{
public function testOAuth2(): void
{
$baseUri = 'http://test.com';
$stack = HandlerStack::create();
$requestDefaults = [];

$client = ApiSession::oAuth2($baseUri, $stack, $requestDefaults);
$client = ApiClient::oAuth2($baseUri, $stack, $requestDefaults);

$this->assertEquals('http://test.com', $client->getConfig('base_uri'));
$this->assertSame($stack, $client->getConfig('handler'));
Expand All @@ -29,7 +29,7 @@ public function testOAuth2Grants(): void
'client_secret' => 'testsecret',
];

$stack = ApiSession::oAuth2Grants($baseUri, $creds);
$stack = ApiClient::oAuth2Grants($baseUri, $creds);

$this->assertInstanceOf(HandlerStack::class, $stack);
}
Expand All @@ -44,7 +44,7 @@ public function testOAuth1(): void
'token_secret' => 'testtokensecret',
];

$client = ApiSession::oAuth1($baseUri, $creds);
$client = ApiClient::oAuth1($baseUri, $creds);

$this->assertEquals('http://test.com', $client->getConfig('base_uri'));
$this->assertEquals('oauth', $client->getConfig('auth'));
Expand All @@ -58,7 +58,7 @@ public function testBasicAuth(): void
'password' => 'testpass',
];

$client = ApiSession::basicAuth($baseUri, $creds);
$client = ApiClient::basicAuth($baseUri, $creds);

$this->assertEquals('http://test.com', $client->getConfig('base_uri'));
$this->assertEquals($creds, $client->getConfig('auth'));
Expand All @@ -73,7 +73,7 @@ public function testDigest(): void
'digest' => 'testdigest',
];

$client = ApiSession::digest($baseUri, $creds);
$client = ApiClient::digest($baseUri, $creds);

$config = $client->getConfig();
$this->assertEquals('http://test.com', $config[1]['base_uri']);
Expand All @@ -89,7 +89,7 @@ public function testNtlm(): void
'ntlm' => 'testntlm',
];

$client = ApiSession::ntlm($baseUri, $creds);
$client = ApiClient::ntlm($baseUri, $creds);

$this->assertEquals('http://test.com', $client->getConfig('base_uri'));
$this->assertEquals($creds, $client->getConfig('auth'));
Expand Down

0 comments on commit 5aeafc0

Please sign in to comment.