Skip to content

Commit

Permalink
Add missing "long", "lat", "country" body parameters for devices endp…
Browse files Browse the repository at this point in the history
…oint
  • Loading branch information
norkunas committed Apr 19, 2018
1 parent 41dbd9a commit 7725e7a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Resolver/DeviceResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ public function resolve(array $data)
->setDefined('test_type')
->setAllowedTypes('test_type', 'int')
->setAllowedValues('test_type', [1, 2])
->setDefined('long')
->setAllowedTypes('long', 'double')
->setDefined('lat')
->setAllowedTypes('lat', 'double')
->setDefined('country')
->setAllowedTypes('country', 'string')
->setDefault('app_id', $this->config->getApplicationId())
->setAllowedTypes('app_id', 'string');

Expand All @@ -88,6 +94,8 @@ public function resolve(array $data)
Devices::SAFARI,
Devices::FIREFOX,
Devices::MACOS,
Devices::ALEXA,
Devices::EMAIL,
]);
}

Expand Down
6 changes: 6 additions & 0 deletions tests/OneSignal/Tests/Resolver/DeviceResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public function testResolveWithValidValues()
'last_active' => 98,
'notification_types' => -2,
'test_type' => 1,
'long' => 55.1684595,
'lat' => 22.7624291,
'country' => 'LT',
'app_id' => 'value',
];

Expand Down Expand Up @@ -100,6 +103,9 @@ public function wrongValueTypesProvider()
[['last_active' => 'wrongType']],
[['notification_types' => 'wrongType']],
[['test_type' => 'wrongType']],
[['long' => true]],
[['lat' => true]],
[['country' => false]],
[['app_id' => 666]],
[['device_type' => 666]],
];
Expand Down

0 comments on commit 7725e7a

Please sign in to comment.