From abf0a930b98c5154d926d3f36a60ab360bb01c58 Mon Sep 17 00:00:00 2001 From: Serhiy Lunak Date: Sun, 1 Sep 2024 09:54:38 +0100 Subject: [PATCH] CreateGroupResponse missing its UnitTest file Fixes #32 --- .../Response/CreateGroupResponseTest.php | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/Client/Response/CreateGroupResponseTest.php diff --git a/tests/Client/Response/CreateGroupResponseTest.php b/tests/Client/Response/CreateGroupResponseTest.php new file mode 100644 index 0000000..ac6dded --- /dev/null +++ b/tests/Client/Response/CreateGroupResponseTest.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Client\Response; + +use PHPUnit\Framework\Attributes\Depends; +use PHPUnit\Framework\TestCase; +use Serhiy\Pushover\Client\Response\CreateGroupResponse; + +final class CreateGroupResponseTest extends TestCase +{ + public function testCanBeConstructed(): CreateGroupResponse + { + $successfulCurlResponse = '{"status":1,"request":"aaaaaaaa-1111-bbbb-2222-cccccccccccc","group":"go4abk17j3itsva6thz99mdudgq2gm"}'; + $response = new CreateGroupResponse($successfulCurlResponse); + + $this->assertInstanceOf(CreateGroupResponse::class, $response); + $this->assertTrue($response->isSuccessful()); + $this->assertSame('aaaaaaaa-1111-bbbb-2222-cccccccccccc', $response->getRequestToken()); + + return $response; + } + + #[Depends('testCanBeConstructed')] + public function testGetGroup(CreateGroupResponse $response): void + { + $group = $response->getGroupKey(); + $this->assertSame($group, 'go4abk17j3itsva6thz99mdudgq2gm'); + } +}