Skip to content

Commit 77dbb6b

Browse files
committed
Test set_site
1 parent b60dc23 commit 77dbb6b

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

tests/ClientTest.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,36 @@
22

33
namespace UniFi_API\Tests;
44

5+
use UniFi_API\Client;
56
use PHPUnit\Framework\TestCase;
67

78
class ClientTest extends TestCase
89
{
9-
public function testSomething()
10+
private $client;
11+
12+
protected function setUp()
13+
{
14+
$this->client = new Client('unifi', 'unifi');
15+
}
16+
17+
public function testSetSite()
1018
{
19+
// default
20+
$this->assertEquals('default', $this->client->get_site());
21+
22+
// custom
23+
$this->client->set_site('foobar');
24+
$this->assertEquals('foobar', $this->client->get_site());
25+
26+
// whitespace
27+
$this->client->set_site(' foobar ');
28+
$this->assertEquals('foobar', $this->client->get_site());
1129

30+
// whitespace (debug mode)
31+
$this->client->set_debug(true);
32+
$this->expectException(\PHPUnit_Framework_Error_Notice::class);
33+
$this->expectExceptionCode(E_USER_NOTICE);
34+
$this->expectExceptionMessage('The provided (short) site name may not contain any spaces');
35+
$this->client->set_site(' foobar ');
1236
}
1337
}

0 commit comments

Comments
 (0)