Skip to content

Commit aed28db

Browse files
committed
tests: Responses/Notification
1 parent 08ef209 commit aed28db

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Keboola\NotificationClient\Tests\Responses;
6+
7+
use Keboola\NotificationClient\Exception\ClientException;
8+
use Keboola\NotificationClient\Responses\Notification;
9+
use PHPUnit\Framework\TestCase;
10+
11+
class NotificationTest extends TestCase
12+
{
13+
public function testAccessors(): void
14+
{
15+
$data = [
16+
'id' => '123',
17+
];
18+
$notification = new Notification($data);
19+
self::assertSame('123', $notification->getId());
20+
}
21+
22+
public function testInvalidData(): void
23+
{
24+
$data = [
25+
'some' => 'value',
26+
];
27+
$this->expectException(ClientException::class);
28+
$this->expectExceptionMessage('Unrecognized response');
29+
$this->expectExceptionCode(0);
30+
new Notification($data);
31+
}
32+
}

0 commit comments

Comments
 (0)