Skip to content

Commit f8626d3

Browse files
committed
Add missing "android_channel_id" and "existing_android_channel_id" options
1 parent da75066 commit f8626d3

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/Resolver/NotificationResolver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ public function resolve(array $data)
9999
->setNormalizer('buttons', function (Options $options, array $values) {
100100
return $this->normalizeButtons($values);
101101
})
102+
->setDefined('android_channel_id')
103+
->setAllowedTypes('android_channel_id', 'string')
104+
->setDefined('existing_android_channel_id')
105+
->setAllowedTypes('existing_android_channel_id', 'string')
102106
->setDefined('android_background_layout')
103107
->setAllowedTypes('android_background_layout', 'array')
104108
->setAllowedValues('android_background_layout', function ($layouts) {

tests/OneSignal/Tests/Resolver/NotificationResolverTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public function testResolveWithValidValues()
5959
'wp_wns_sound' => 'value',
6060
'data' => ['value'],
6161
'buttons' => [],
62+
'android_channel_id' => '09228c02-6188-4307-b139-402600213d0e',
63+
'existing_android_channel_id' => '09228c02-6188-4307-b139-402600213d0e',
6264
'android_background_layout' => ['value'],
6365
'small_icon' => 'value',
6466
'large_icon' => 'value',
@@ -147,6 +149,8 @@ public function wrongValueTypesProvider()
147149
[['wp_wns_sound' => 666]],
148150
[['data' => 666]],
149151
[['buttons' => 666]],
152+
[['android_channel_id' => 666]],
153+
[['existing_android_channel_id' => 666]],
150154
[['android_background_layout' => 666]],
151155
[['small_icon' => 666]],
152156
[['large_icon' => 666]],
@@ -325,8 +329,6 @@ public function testDateTime()
325329
$inputData = new \DateTime();
326330
$expectedData = $inputData->format(NotificationResolver::SEND_AFTER_FORMAT);
327331

328-
$this->assertEquals(
329-
$expectedData,
330-
$method->invokeArgs($this->notificationResolver, [new OptionsResolver(), $inputData, NotificationResolver::SEND_AFTER_FORMAT]));
332+
$this->assertEquals($expectedData, $method->invokeArgs($this->notificationResolver, [new OptionsResolver(), $inputData, NotificationResolver::SEND_AFTER_FORMAT]));
331333
}
332334
}

0 commit comments

Comments
 (0)