Skip to content

Commit 472fcf2

Browse files
add "name" to Notifications payload (#154)
* add name to Notifications payload * add "name" Notification property to tests * update NotificationResolverTest to accommodate for "name" * normalize test
1 parent 92719e4 commit 472fcf2

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

src/Resolver/NotificationResolver.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public function __construct(Config $config)
2727
public function resolve(array $data): array
2828
{
2929
return (new OptionsResolver())
30+
->setDefined('name')
31+
->setAllowedTypes('name', 'string')
3032
->setDefined('contents')
3133
->setAllowedTypes('contents', 'array')
3234
->setDefined('headings')

tests/NotificationsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ public function testAdd(): void
220220
$notifications = new Notifications($client, new ResolverFactory($client->getConfig()));
221221

222222
$responseData = $notifications->add([
223+
'name' => 'My Notification Name',
223224
'contents' => [
224225
'en' => 'English Message',
225226
],

tests/Resolver/NotificationResolverTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ protected function setUp(): void
2929
public function testResolveWithValidValues(): void
3030
{
3131
$inputData = [
32+
'name' => 'value',
3233
'contents' => ['value'],
3334
'headings' => ['value'],
3435
'subtitle' => ['value'],
@@ -133,6 +134,7 @@ public function testResolveWithValidValues(): void
133134

134135
public function wrongValueTypesProvider(): iterable
135136
{
137+
yield [['name' => 666]];
136138
yield [['contents' => 666]];
137139
yield [['headings' => 666]];
138140
yield [['subtitle' => 666]];

0 commit comments

Comments
 (0)