From e203b5126fdcd951f6119a1da8eed758c84ad8db Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Thu, 9 Jan 2025 10:40:13 +0100 Subject: [PATCH] trim credentials --- src/Connection.php | 4 ++-- tests/unit/ConnectionTest.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Connection.php b/src/Connection.php index 6ec82d8..f2ca63a 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -57,8 +57,8 @@ class Connection ->notBlank() ->verifyNow(); - $this->client_key = $client_key; - $this->secret_key = $secret_key; + $this->client_key = trim($client_key); + $this->secret_key = trim($secret_key); $this->cookies_jar = new CookieJar(); } diff --git a/tests/unit/ConnectionTest.php b/tests/unit/ConnectionTest.php index d4308c2..eb1c437 100644 --- a/tests/unit/ConnectionTest.php +++ b/tests/unit/ConnectionTest.php @@ -56,11 +56,11 @@ class ConnectionTest extends TestCase $sut = new Connection($userName, $password); $this->assertSame( - $userName, + trim($userName), $sut->getClientKey() ); $this->assertSame( - $password, + trim($password), $sut->getSecretKey() ); $this->assertInstanceOf( @@ -71,7 +71,7 @@ class ConnectionTest extends TestCase public static function constructDataProvider(): Generator { - yield 'all credentials set' => ['myuser', 'mypassword', false]; + yield 'all credentials set' => [' myuser', ' mypassword', false]; yield 'missing username' => ['', 'mypassword', true]; yield 'missing password' => ['myuser', '', true]; yield 'no credentials given' => ['', '', true];