From 6ad5cece6aea9ecaa1e5bf52683d7e26af4164ac Mon Sep 17 00:00:00 2001 From: Thorsten Suckow-Homberg Date: Thu, 5 Jan 2023 17:50:30 +0100 Subject: [PATCH 1/5] refactor: rename MailAccount's "root" to "subscriptions" refs conjoon/conjoon#23 --- src/Mail/Client/Data/MailAccount.php | 12 ++++++------ src/Mail/Client/Service/DefaultMailFolderService.php | 6 +++--- src/Mail/Client/Service/MailFolderService.php | 5 +++-- tests/Mail/Client/Data/MailAccountTest.php | 12 ++++++------ .../Client/Service/DefaultMailFolderServiceTest.php | 4 ++-- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Mail/Client/Data/MailAccount.php b/src/Mail/Client/Data/MailAccount.php index 975561a7..702dabb0 100644 --- a/src/Mail/Client/Data/MailAccount.php +++ b/src/Mail/Client/Data/MailAccount.php @@ -3,7 +3,7 @@ /** * conjoon * php-lib-conjoon - * Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon + * Copyright (C) 2019-2023 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -56,14 +56,14 @@ * "outbox_user" => "outboxuser", * "outbox_password" => "outboxpassword', * 'outbox_secure' => "tls", - * 'root' => "INBOX" + * 'subscriptions' => ["INBOX"] * ]); * * $account->getOutboxSecure(); // true * $account->getInboxPort(); // 993 * $account->getReplyTo(); // ['name' => 'John Smith', 'address' => 'dev@conjoon.org'], * - * The property "root" allows for specifying a root mailbox and defaults to "INBOX". + * The property "subscriptions" allows for specifying mailbox the account is subscribed to. * * @package Conjoon\Mail\Client\Data * @@ -82,7 +82,7 @@ * @method string getOutboxAddress() * @method int getOutboxPort() * @method string getOutboxSecure() - * @method array getRoot() + * @method array getSubscriptions() * * @noinspection SpellCheckingInspection */ @@ -166,7 +166,7 @@ class MailAccount implements Jsonable, Arrayable /** * @var array */ - protected array $root = ["INBOX"]; + protected array $subscriptions = ["INBOX"]; /** * MailAccount constructor. @@ -240,7 +240,7 @@ public function toArray(): array "outbox_user" => $this->getOutboxUser(), "outbox_password" => $this->getOutboxPassword(), "outbox_secure" => $this->getOutboxSecure(), - "root" => $this->getRoot() + "subscriptions" => $this->getSubscriptions() ]; } diff --git a/src/Mail/Client/Service/DefaultMailFolderService.php b/src/Mail/Client/Service/DefaultMailFolderService.php index a2e29973..26018e8b 100644 --- a/src/Mail/Client/Service/DefaultMailFolderService.php +++ b/src/Mail/Client/Service/DefaultMailFolderService.php @@ -3,7 +3,7 @@ /** * conjoon * php-lib-conjoon - * Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon + * Copyright (C) 2019-2023 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -92,10 +92,10 @@ public function getMailClient(): MailClient /** * @inheritdoc */ - public function getMailFolderChildList(MailAccount $mailAccount): MailFolderChildList + public function getMailFolderChildList(MailAccount $mailAccount, array $subscriptions = []): MailFolderChildList { $mailFolderList = $this->getMailClient()->getMailFolderList($mailAccount); - return $this->getMailFolderTreeBuilder()->listToTree($mailFolderList, $mailAccount->getRoot()); + return $this->getMailFolderTreeBuilder()->listToTree($mailFolderList, $subscriptions); } } diff --git a/src/Mail/Client/Service/MailFolderService.php b/src/Mail/Client/Service/MailFolderService.php index c7b4b995..8db03a6a 100644 --- a/src/Mail/Client/Service/MailFolderService.php +++ b/src/Mail/Client/Service/MailFolderService.php @@ -3,7 +3,7 @@ /** * conjoon * php-lib-conjoon - * Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon + * Copyright (C) 2019-2023 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -40,6 +40,7 @@ interface MailFolderService * MailAccount. * * @param MailAccount $mailAccount + * @param array $subscriptions * * @return MailFolderChildList An MailFolderChildList of the Mailbox-structure * found on the server. @@ -55,7 +56,7 @@ interface MailFolderService * * @see \Horde_Imap_Client_Socket */ - public function getMailFolderChildList(MailAccount $mailAccount): MailFolderChildList; + public function getMailFolderChildList(MailAccount $mailAccount, array $subscriptions = []): MailFolderChildList; /** diff --git a/tests/Mail/Client/Data/MailAccountTest.php b/tests/Mail/Client/Data/MailAccountTest.php index 11651759..1f01d2cc 100644 --- a/tests/Mail/Client/Data/MailAccountTest.php +++ b/tests/Mail/Client/Data/MailAccountTest.php @@ -3,7 +3,7 @@ /** * conjoon * php-lib-conjoon - * Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon + * Copyright (C) 2019-2023 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -59,7 +59,7 @@ class MailAccountTest extends TestCase "outbox_user" => "user", "outbox_password" => "password outbox", "outbox_secure" => "ssl", - "root" => ["[Gmail]"] + "subscriptions" => ["[Gmail]"] ]; @@ -81,14 +81,14 @@ public function testGetter() { $config = $this->accountConfig; - $oldRoot = $config["root"]; + $oldRoot = $config["subscriptions"]; $this->assertSame(["[Gmail]"], $oldRoot); - unset($config["root"]); + unset($config["subscriptions"]); $account = new MailAccount($config); - $this->assertSame(["INBOX"], $account->getRoot()); + $this->assertSame(["INBOX"], $account->getSubscriptions()); - $config["root"] = $oldRoot; + $config["subscriptions"] = $oldRoot; $account = new MailAccount($config); foreach ($config as $property => $value) { diff --git a/tests/Mail/Client/Service/DefaultMailFolderServiceTest.php b/tests/Mail/Client/Service/DefaultMailFolderServiceTest.php index 9829aa34..542522e5 100644 --- a/tests/Mail/Client/Service/DefaultMailFolderServiceTest.php +++ b/tests/Mail/Client/Service/DefaultMailFolderServiceTest.php @@ -3,7 +3,7 @@ /** * conjoon * php-lib-conjoon - * Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon + * Copyright (C) 2019-2023 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -90,7 +90,7 @@ public function testGetMailFolderChildList() ->with($mailFolderList, ["INBOX"]) ->andReturn($resultList); - $this->assertSame($resultList, $service->getMailFolderChildList($mailAccount)); + $this->assertSame($resultList, $service->getMailFolderChildList($mailAccount, ["INBOX"])); } From ba89d991e88afd0b9b254e5cc2a5464f841f8846 Mon Sep 17 00:00:00 2001 From: Thorsten Suckow-Homberg Date: Thu, 5 Jan 2023 18:08:51 +0100 Subject: [PATCH 2/5] refactor: re-organize namespaces of auth related classes refs conjoon/conjoon#23 --- src/Illuminate/Auth/Imap/DefaultImapUserProvider.php | 4 +++- src/Illuminate/Auth/{Imap => }/ImapUser.php | 4 ++-- src/Illuminate/Auth/{Imap => }/ImapUserProvider.php | 7 ++++--- .../Illuminate/Auth/Imap/DefaultImapUserProviderTest.php | 9 ++++----- .../Illuminate/Auth/{Imap => }/ImapUserProviderTest.php | 9 ++++----- tests/Illuminate/Auth/{Imap => }/ImapUserTest.php | 9 ++++----- 6 files changed, 21 insertions(+), 21 deletions(-) rename src/Illuminate/Auth/{Imap => }/ImapUser.php (98%) rename src/Illuminate/Auth/{Imap => }/ImapUserProvider.php (90%) rename tests/Illuminate/Auth/{Imap => }/ImapUserProviderTest.php (86%) rename tests/Illuminate/Auth/{Imap => }/ImapUserTest.php (94%) diff --git a/src/Illuminate/Auth/Imap/DefaultImapUserProvider.php b/src/Illuminate/Auth/Imap/DefaultImapUserProvider.php index 60d8537c..697eaeb3 100644 --- a/src/Illuminate/Auth/Imap/DefaultImapUserProvider.php +++ b/src/Illuminate/Auth/Imap/DefaultImapUserProvider.php @@ -3,7 +3,7 @@ /** * conjoon * php-lib-conjoon - * Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon + * Copyright (C) 2019-2023 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -30,6 +30,8 @@ namespace Conjoon\Illuminate\Auth\Imap; use Conjoon\Illuminate\Auth\Imap\Util as ImapUtil; +use Conjoon\Illuminate\Auth\ImapUser; +use Conjoon\Illuminate\Auth\ImapUserProvider; use Illuminate\Contracts\Auth\Authenticatable; /** diff --git a/src/Illuminate/Auth/Imap/ImapUser.php b/src/Illuminate/Auth/ImapUser.php similarity index 98% rename from src/Illuminate/Auth/Imap/ImapUser.php rename to src/Illuminate/Auth/ImapUser.php index 987452cd..afe556c5 100644 --- a/src/Illuminate/Auth/Imap/ImapUser.php +++ b/src/Illuminate/Auth/ImapUser.php @@ -3,7 +3,7 @@ /** * conjoon * php-lib-conjoon - * Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon + * Copyright (C) 2019-2023 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -27,7 +27,7 @@ declare(strict_types=1); -namespace Conjoon\Illuminate\Auth\Imap; +namespace Conjoon\Illuminate\Auth; use Conjoon\Mail\Client\Data\MailAccount; use Illuminate\Contracts\Auth\Authenticatable; diff --git a/src/Illuminate/Auth/Imap/ImapUserProvider.php b/src/Illuminate/Auth/ImapUserProvider.php similarity index 90% rename from src/Illuminate/Auth/Imap/ImapUserProvider.php rename to src/Illuminate/Auth/ImapUserProvider.php index a6f2807c..91c419d8 100644 --- a/src/Illuminate/Auth/Imap/ImapUserProvider.php +++ b/src/Illuminate/Auth/ImapUserProvider.php @@ -3,7 +3,7 @@ /** * conjoon * php-lib-conjoon - * Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon + * Copyright (C) 2019-2023 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -27,8 +27,9 @@ declare(strict_types=1); -namespace Conjoon\Illuminate\Auth\Imap; +namespace Conjoon\Illuminate\Auth; +use Conjoon\Illuminate\Auth\Imap\Conjoon; use Illuminate\Contracts\Auth\UserProvider; /** @@ -45,7 +46,7 @@ interface ImapUserProvider extends UserProvider * @param string $username * @param string $password * - * @return Conjoon\Illuminate\Auth\Imap\ImapUser|null + * @return ImapUser|null */ public function getUser(string $username, string $password): ?ImapUser; } diff --git a/tests/Illuminate/Auth/Imap/DefaultImapUserProviderTest.php b/tests/Illuminate/Auth/Imap/DefaultImapUserProviderTest.php index cb5f56a5..c9ad3f8e 100644 --- a/tests/Illuminate/Auth/Imap/DefaultImapUserProviderTest.php +++ b/tests/Illuminate/Auth/Imap/DefaultImapUserProviderTest.php @@ -3,7 +3,7 @@ /** * conjoon * php-lib-conjoon - * Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon + * Copyright (C) 2019-2023 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -30,14 +30,13 @@ namespace Tests\Conjoon\Illuminate\Auth\Imap; use Conjoon\Illuminate\Auth\Imap\DefaultImapUserProvider; -use Conjoon\Illuminate\Auth\Imap\ImapUser; -use Conjoon\Illuminate\Auth\Imap\ImapUserProvider; use Conjoon\Mail\Client\Data\MailAccount; +use Conjoon\Illuminate\Auth\ImapUser; +use Conjoon\Illuminate\Auth\ImapUserProvider; use Tests\TestCase; /** - * Class DefaultImapUserProviderTest - * @package Tests\Conjoon\Illuminate\Auth\Imap + * Tests DefaultImapUserProvider. */ class DefaultImapUserProviderTest extends TestCase { diff --git a/tests/Illuminate/Auth/Imap/ImapUserProviderTest.php b/tests/Illuminate/Auth/ImapUserProviderTest.php similarity index 86% rename from tests/Illuminate/Auth/Imap/ImapUserProviderTest.php rename to tests/Illuminate/Auth/ImapUserProviderTest.php index 1c48f024..1754ddf7 100644 --- a/tests/Illuminate/Auth/Imap/ImapUserProviderTest.php +++ b/tests/Illuminate/Auth/ImapUserProviderTest.php @@ -3,7 +3,7 @@ /** * conjoon * php-lib-conjoon - * Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon + * Copyright (C) 2019-2023 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -27,15 +27,14 @@ declare(strict_types=1); -namespace Tests\Conjoon\Illuminate\Auth\Imap; +namespace Tests\Conjoon\Illuminate\Auth; -use Conjoon\Illuminate\Auth\Imap\ImapUserProvider; +use Conjoon\Illuminate\Auth\ImapUserProvider; use Illuminate\Contracts\Auth\UserProvider; use Tests\TestCase; /** - * Class ImapUserProviderTest - * @package Tests\Conjoon\Illuminate\Auth\Imap + * Tests ImapUserProvider. */ class ImapUserProviderTest extends TestCase { diff --git a/tests/Illuminate/Auth/Imap/ImapUserTest.php b/tests/Illuminate/Auth/ImapUserTest.php similarity index 94% rename from tests/Illuminate/Auth/Imap/ImapUserTest.php rename to tests/Illuminate/Auth/ImapUserTest.php index 1d9777c7..b955dc0e 100644 --- a/tests/Illuminate/Auth/Imap/ImapUserTest.php +++ b/tests/Illuminate/Auth/ImapUserTest.php @@ -3,7 +3,7 @@ /** * conjoon * php-lib-conjoon - * Copyright (C) 2019-2022 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon + * Copyright (C) 2019-2023 Thorsten Suckow-Homberg https://github.com/conjoon/php-lib-conjoon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -27,16 +27,15 @@ declare(strict_types=1); -namespace Tests\Conjoon\Illuminate\Auth\Imap; +namespace Tests\Conjoon\Illuminate\Auth; -use Conjoon\Illuminate\Auth\Imap\ImapUser; use Conjoon\Mail\Client\Data\MailAccount; +use Conjoon\Illuminate\Auth\ImapUser; use Illuminate\Contracts\Auth\Authenticatable; use Tests\TestCase; /** - * Class ImapUserTest - * @package Tests\Conjoon\Illuminate\Auth\Imap + * Tests ImapUser. */ class ImapUserTest extends TestCase { From 050d88ce5312f65859d889477ffd198dd7c353ff Mon Sep 17 00:00:00 2001 From: Thorsten Suckow-Homberg Date: Thu, 5 Jan 2023 19:07:58 +0100 Subject: [PATCH 3/5] feat: add LocalAccountProvider for extracting account info from request payload refs conjoon/conjoon#23 --- .../LocalMailAccount/LocalAccountProvider.php | 83 +++++++++++ .../LocalAccountProviderTest.php | 139 ++++++++++++++++++ 2 files changed, 222 insertions(+) create mode 100644 src/Illuminate/Auth/LocalMailAccount/LocalAccountProvider.php create mode 100644 tests/Illuminate/Auth/LocalMailAccount/LocalAccountProviderTest.php diff --git a/src/Illuminate/Auth/LocalMailAccount/LocalAccountProvider.php b/src/Illuminate/Auth/LocalMailAccount/LocalAccountProvider.php new file mode 100644 index 00000000..7837f16d --- /dev/null +++ b/src/Illuminate/Auth/LocalMailAccount/LocalAccountProvider.php @@ -0,0 +1,83 @@ +payload = $request->header("x-cnmail-data"); + $this->mailAccountId = $request->route('mailAccountId'); + } + + + public function getUser(string $username, string $password): ?ImapUser + { + $config = $this->decodePayload($this->payload); + $mailAccount = $this->createMailAccount($config); + + return new ImapUser($username, $password, $mailAccount); + } + + private function createMailAccount(array $config): MailAccount + { + $merged = array_merge($config, [ + "id" => $this->mailAccountId, + "name" => $this->mailAccountId, + ]); + return new MailAccount($merged); + } + + private function decodePayload(string $payload): array + { + return json_decode(base64_decode($payload), true); + } + +} diff --git a/tests/Illuminate/Auth/LocalMailAccount/LocalAccountProviderTest.php b/tests/Illuminate/Auth/LocalMailAccount/LocalAccountProviderTest.php new file mode 100644 index 00000000..9f71b854 --- /dev/null +++ b/tests/Illuminate/Auth/LocalMailAccount/LocalAccountProviderTest.php @@ -0,0 +1,139 @@ +getMockBuilder(Request::class) + ->onlyMethods(["header", "route"]) + ->disableOriginalConstructor() + ->getMock(); + + $request->expects($this->once())->method("header")->with("x-cnmail-data")->willReturn("headerpayload"); + $request->expects($this->once())->method("route")->with("mailAccountId")->willReturn("routeId"); + + $provider = new LocalAccountProvider($request); + $this->assertInstanceOf(DefaultImapUserProvider::class, $provider); + + $payload = $this->makeAccessible($provider, "payload", true); + $mailAccountId = $this->makeAccessible($provider, "mailAccountId", true); + + $this->assertSame("headerpayload", $payload->getValue($provider)); + $this->assertSame("routeId", $mailAccountId->getValue($provider)); + } + + + public function testDecodePayload() + { + $provider = new LocalAccountProvider(new Request()); + $decodePayload = $this->makeAccessible($provider, "decodePayload"); + + $target = ["encoded" => "json"]; + $str = base64_encode(json_encode($target)); + + $this->assertSame($target, $decodePayload->invokeArgs($provider, [$str])); + } + + + public function testGetUser() + { + $request = $this->getMockBuilder(Request::class) + ->onlyMethods(["header", "route"]) + ->disableOriginalConstructor() + ->getMock(); + + $request->expects($this->once())->method("route")->with("mailAccountId")->willReturn("routeId"); + + $conf = [ + "from" => ["address" => "", "name" => "name"], + "replyTo" => ["address" => "", "name" => "name"], + "inbox_address" => "address", + "inbox_port" => 8080, + "inbox_user" => "user", + "inbox_password" => "pw", + "outbox_address" => "address", + "outbox_port" => 8080, + "outbox_user" => "user", + "outbox_password" => "pw", + "inbox_ssl" => true, + "outbox_secure" => "tls" + ]; + + $request->expects($this->once())->method("header")->with("x-cnmail-data")->willReturn( + base64_encode(json_encode($conf)) + ); + + $provider = new LocalAccountProvider($request); + + $user = $provider->getUser("username", "password"); + $this->assertInstanceOf(ImapUser::class, $user); + + $this->assertNull($user->getMailAccount("routeIdNotAvailable")); + $account = $user->getMailAccount("routeId"); + + $toArray = $account->toArray(); + + foreach ($conf as $key => $value) { + $this->assertSame($value, $toArray[$key]); + } + + $this->assertSame("routeId", $toArray["id"]); + $this->assertSame("routeId", $toArray["name"]); + + } + + + protected function makeAccessible($inst, $name, $isProperty = false) + { + $refl = new ReflectionClass($inst); + + $name = $isProperty + ? $refl->getProperty($name) + : $refl->getMethod($name); + + $name->setAccessible(true); + + return $name; + } + + +} From 8c5b7c2a7c478cfb06bd709ba0f61af30b68314c Mon Sep 17 00:00:00 2001 From: Thorsten Suckow-Homberg Date: Fri, 6 Jan 2023 19:07:33 +0100 Subject: [PATCH 4/5] fix: username/password not set for MailAccount refs conjoon/conjoon#23 --- .../Auth/LocalMailAccount/LocalAccountProvider.php | 6 ++++-- .../Auth/LocalMailAccount/LocalAccountProviderTest.php | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Auth/LocalMailAccount/LocalAccountProvider.php b/src/Illuminate/Auth/LocalMailAccount/LocalAccountProvider.php index 7837f16d..36b77616 100644 --- a/src/Illuminate/Auth/LocalMailAccount/LocalAccountProvider.php +++ b/src/Illuminate/Auth/LocalMailAccount/LocalAccountProvider.php @@ -61,16 +61,18 @@ public function __construct(Request $request) public function getUser(string $username, string $password): ?ImapUser { $config = $this->decodePayload($this->payload); - $mailAccount = $this->createMailAccount($config); + $mailAccount = $this->createMailAccount($username, $password, $config); return new ImapUser($username, $password, $mailAccount); } - private function createMailAccount(array $config): MailAccount + private function createMailAccount(string $username, string $password, array $config): MailAccount { $merged = array_merge($config, [ "id" => $this->mailAccountId, "name" => $this->mailAccountId, + "inbox_user" => $username, + "inbox_password" => $password ]); return new MailAccount($merged); } diff --git a/tests/Illuminate/Auth/LocalMailAccount/LocalAccountProviderTest.php b/tests/Illuminate/Auth/LocalMailAccount/LocalAccountProviderTest.php index 9f71b854..944c7f75 100644 --- a/tests/Illuminate/Auth/LocalMailAccount/LocalAccountProviderTest.php +++ b/tests/Illuminate/Auth/LocalMailAccount/LocalAccountProviderTest.php @@ -88,8 +88,8 @@ public function testGetUser() "replyTo" => ["address" => "", "name" => "name"], "inbox_address" => "address", "inbox_port" => 8080, - "inbox_user" => "user", - "inbox_password" => "pw", + "inbox_user" => "inboxUsername", + "inbox_password" => "inboxPassword", "outbox_address" => "address", "outbox_port" => 8080, "outbox_user" => "user", @@ -104,7 +104,7 @@ public function testGetUser() $provider = new LocalAccountProvider($request); - $user = $provider->getUser("username", "password"); + $user = $provider->getUser("inboxUsername", "inboxPassword"); $this->assertInstanceOf(ImapUser::class, $user); $this->assertNull($user->getMailAccount("routeIdNotAvailable")); From 4626f37b5675bfd9ee633c7c2c0f4dab47bb1d3a Mon Sep 17 00:00:00 2001 From: Thorsten Suckow-Homberg Date: Sat, 28 Jan 2023 15:48:58 +0100 Subject: [PATCH 5/5] chore(style): update source code formatting according to PSR-12 --- src/Illuminate/Auth/LocalMailAccount/LocalAccountProvider.php | 1 - .../Auth/LocalMailAccount/LocalAccountProviderTest.php | 3 --- 2 files changed, 4 deletions(-) diff --git a/src/Illuminate/Auth/LocalMailAccount/LocalAccountProvider.php b/src/Illuminate/Auth/LocalMailAccount/LocalAccountProvider.php index 36b77616..f1220e33 100644 --- a/src/Illuminate/Auth/LocalMailAccount/LocalAccountProvider.php +++ b/src/Illuminate/Auth/LocalMailAccount/LocalAccountProvider.php @@ -81,5 +81,4 @@ private function decodePayload(string $payload): array { return json_decode(base64_decode($payload), true); } - } diff --git a/tests/Illuminate/Auth/LocalMailAccount/LocalAccountProviderTest.php b/tests/Illuminate/Auth/LocalMailAccount/LocalAccountProviderTest.php index 944c7f75..7254644a 100644 --- a/tests/Illuminate/Auth/LocalMailAccount/LocalAccountProviderTest.php +++ b/tests/Illuminate/Auth/LocalMailAccount/LocalAccountProviderTest.php @@ -118,7 +118,6 @@ public function testGetUser() $this->assertSame("routeId", $toArray["id"]); $this->assertSame("routeId", $toArray["name"]); - } @@ -134,6 +133,4 @@ protected function makeAccessible($inst, $name, $isProperty = false) return $name; } - - }