-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathServicePlanAddonTest.php
62 lines (50 loc) · 1.91 KB
/
ServicePlanAddonTest.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
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
<?php
// Copyright 1999-2025. WebPros International GmbH.
namespace PleskXTest;
class ServicePlanAddonTest extends AbstractTestCase
{
public function testGet()
{
$servicePlanAddon = static::createServicePlanAddon();
$servicePlanAddonInfo = static::$client->servicePlanAddon()->get('id', $servicePlanAddon->id);
$this->assertNotEmpty($servicePlanAddonInfo->name);
$this->assertSame($servicePlanAddon->id, $servicePlanAddonInfo->id);
}
public function testGetAll()
{
static::createServicePlanAddon();
static::createServicePlanAddon();
static::createServicePlanAddon();
$servicePlanAddons = static::$client->servicePlanAddon()->getAll();
$this->assertIsArray($servicePlanAddons);
$this->assertGreaterThan(2, count($servicePlanAddons));
$this->assertNotEmpty($servicePlanAddons[0]->name);
}
public function testCreate()
{
$servicePlanAddon = static::createServicePlanAddon();
$this->assertGreaterThan(0, $servicePlanAddon->id);
static::$client->servicePlanAddon()->delete('id', $servicePlanAddon->id);
}
public function testDelete()
{
$servicePlanAddon = static::createServicePlanAddon();
$result = static::$client->servicePlanAddon()->delete('id', $servicePlanAddon->id);
$this->assertTrue($result);
}
public function testCreateComplex()
{
$properties = [
'name' => 'Complex Service Plan Addon',
'limits' => [
'limit' => [
'name' => 'disk_space',
'value' => 1024 * 1024 * 1024, // 1 GB
],
],
];
$servicePlanAddon = static::$client->servicePlanAddon()->create($properties);
$this->assertGreaterThan(0, $servicePlanAddon->id);
static::$client->servicePlanAddon()->delete('id', $servicePlanAddon->id);
}
}