generated from DJTommek/php-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathStaticMapsTest.php
35 lines (31 loc) · 1.34 KB
/
StaticMapsTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php declare(strict_types=1);
namespace Tests\MapBox;
use DJTommek\Coordinates\Coordinates;
use DJTommek\Coordinates\CoordinatesInterface;
use PHPUnit\Framework\TestCase;
final class StaticMapsTest extends TestCase
{
public static function basicProvider(): array
{
return [
[
'https://api.mapbox.com/styles/v1/mapbox/streets-v12/static/geojson(%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22marker-label%22%3A%2212%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22MultiPoint%22%2C%22coordinates%22%3A%5B%5B2.0%2C1.0%5D%5D%7D%7D)/auto/600x600?access_token=someApiKey',
[new Coordinates(1, 2)],
],
[
'https://api.mapbox.com/styles/v1/mapbox/streets-v12/static/geojson(%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%22marker-label%22%3A%2212%22%7D%2C%22geometry%22%3A%7B%22type%22%3A%22MultiPoint%22%2C%22coordinates%22%3A%5B%5B2.0%2C1.0%5D%2C%5B86.987654%2C-9.12345%5D%5D%7D%7D)/auto/600x600?access_token=someApiKey',
[new Coordinates(1, 2), new Coordinates(-9.12345, 86.987654321)],
],
];
}
/**
* @dataProvider basicProvider
* @param array<CoordinatesInterface> $markers
*/
public function testBasic(string $expectedPrivateUrl, array $markers): void
{
$api = new \App\MapBox\StaticMaps('someApiKey');
$privateUrl = $api->generatePrivateUrl($markers);
$this->assertSame($expectedPrivateUrl, $privateUrl);
}
}