-
-
Notifications
You must be signed in to change notification settings - Fork 208
Expand file tree
/
Copy pathProjectResourceEntityTest.php
More file actions
64 lines (56 loc) · 2.35 KB
/
ProjectResourceEntityTest.php
File metadata and controls
64 lines (56 loc) · 2.35 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
declare(strict_types=1);
/*
* This file is part of the DigitalOcean API library.
*
* (c) Antoine Kirk <contact@sbin.dk>
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace DigitalOceanV2\Tests;
use DigitalOceanV2\Entity\AbstractEntity;
use DigitalOceanV2\Entity\ProjectResource;
use PHPUnit\Framework\TestCase;
/**
* @author Graham Campbell <hello@gjcampbell.co.uk>
* @author Mohammad Salamat <godfather@mofia.org>
*/
class ProjectResourceEntityTest extends TestCase
{
public function testConstructor(): void
{
$projectResource = new ProjectResource([
'urn' => 'do:droplet:123456789',
'assignedAt' => '2022-08-04T04:26:24Z',
'links' => [
'self' => 'https://api.digitalocean.com/v2/droplets/123456789',
],
'status' => 'already_assigned',
]);
self::assertInstanceOf(AbstractEntity::class, $projectResource);
self::assertInstanceOf(ProjectResource::class, $projectResource);
self::assertSame('do:droplet:123456789', $projectResource->urn);
self::assertSame('2022-08-04T04:26:24Z', $projectResource->assignedAt);
self::assertSame(['self' => 'https://api.digitalocean.com/v2/droplets/123456789'], $projectResource->links);
self::assertSame('already_assigned', $projectResource->status);
}
public function testConstructorAcceptsApiShapedLinksObject(): void
{
$projectResource = new ProjectResource([
'urn' => 'do:droplet:123456789',
'assigned_at' => '2022-08-04T04:26:24Z',
'links' => (object) [
'self' => 'https://api.digitalocean.com/v2/droplets/123456789',
],
'status' => 'already_assigned',
]);
self::assertInstanceOf(AbstractEntity::class, $projectResource);
self::assertInstanceOf(ProjectResource::class, $projectResource);
self::assertSame('do:droplet:123456789', $projectResource->urn);
self::assertSame('2022-08-04T04:26:24Z', $projectResource->assignedAt);
self::assertSame(['self' => 'https://api.digitalocean.com/v2/droplets/123456789'], $projectResource->links);
self::assertSame('already_assigned', $projectResource->status);
}
}