forked from plesk/api-php-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUiTest.php
52 lines (43 loc) · 1.79 KB
/
UiTest.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
<?php
// Copyright 1999-2022. Plesk International GmbH.
namespace PleskXTest;
class UiTest extends AbstractTestCase
{
private array $customButtonProperties = [
'place' => 'admin',
'url' => 'http://example.com',
'text' => 'Example site',
];
public function testGetNavigation()
{
$navigation = static::$client->ui()->getNavigation();
$this->assertIsArray($navigation);
$this->assertGreaterThan(0, count($navigation));
$this->assertArrayHasKey('general', $navigation);
$this->assertArrayHasKey('hosting', $navigation);
$hostingSection = $navigation['hosting'];
$this->assertArrayHasKey('name', $hostingSection);
$this->assertArrayHasKey('nodes', $hostingSection);
$this->assertGreaterThan(0, count($hostingSection['nodes']));
}
public function testCreateCustomButton()
{
$buttonId = static::$client->ui()->createCustomButton('admin', $this->customButtonProperties);
$this->assertGreaterThan(0, $buttonId);
static::$client->ui()->deleteCustomButton($buttonId);
}
public function testGetCustomButton()
{
$buttonId = static::$client->ui()->createCustomButton('admin', $this->customButtonProperties);
$customButtonInfo = static::$client->ui()->getCustomButton($buttonId);
$this->assertEquals('http://example.com', $customButtonInfo->url);
$this->assertEquals('Example site', $customButtonInfo->text);
static::$client->ui()->deleteCustomButton($buttonId);
}
public function testDeleteCustomButton()
{
$buttonId = static::$client->ui()->createCustomButton('admin', $this->customButtonProperties);
$result = static::$client->ui()->deleteCustomButton($buttonId);
$this->assertTrue($result);
}
}