Skip to content

Commit

Permalink
Add email notification parameters on resolver (#90)
Browse files Browse the repository at this point in the history
* Add email notification parameters on resolver

Add email notification support

* Add optional datas (email_from_address, email_from_name) to email notification

* add unit test to new email notification var
  • Loading branch information
Losams authored and norkunas committed Apr 11, 2018
1 parent 696da61 commit 6832f3d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Resolver/NotificationResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,14 @@ public function resolve(array $data)
->setAllowedTypes('priority', 'int')
->setDefault('app_id', $this->config->getApplicationId())
->setAllowedTypes('app_id', 'string')
->setDefined('email_subject')
->setAllowedTypes('email_subject', 'string')
->setDefined('email_body')
->setAllowedTypes('email_body', 'string')
->setDefined('email_from_name')
->setAllowedTypes('email_from_name', 'string')
->setDefined('email_from_address')
->setAllowedTypes('email_from_address', 'string')
->resolve($data);
}

Expand Down
8 changes: 8 additions & 0 deletions tests/OneSignal/Tests/Resolver/NotificationResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public function testResolveWithValidValues()
'ttl' => 23,
'priority' => 10,
'app_id' => 'value',
'email_subject' => 'value',
'email_body' => 'value',
'email_from_name' => 'value',
'email_from_address' => 'value',
];

$expectedData = $inpuData;
Expand Down Expand Up @@ -186,6 +190,10 @@ public function wrongValueTypesProvider()
[['ttl' => 'wrongType']],
[['priority' => 'wrongType']],
[['app_id' => 666]],
[['email_subject' => 666]],
[['email_body' => 666]],
[['email_from_name' => 666]],
[['email_from_address' => 666]],
];
}

Expand Down

0 comments on commit 6832f3d

Please sign in to comment.