|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
// OrganizationTest.php |
|
4
|
|
|
################################################# |
|
5
|
|
|
## |
|
6
|
|
|
## PHPLicengine |
|
7
|
|
|
## |
|
8
|
|
|
################################################# |
|
9
|
|
|
## Copyright 2009-{current_year} PHPLicengine |
|
10
|
|
|
## |
|
11
|
|
|
## Licensed under the Apache License, Version 2.0 (the "License"); |
|
12
|
|
|
## you may not use this file except in compliance with the License. |
|
13
|
|
|
## You may obtain a copy of the License at |
|
14
|
|
|
## |
|
15
|
|
|
## http://www.apache.org/licenses/LICENSE-2.0 |
|
16
|
|
|
## |
|
17
|
|
|
## Unless required by applicable law or agreed to in writing, software |
|
18
|
|
|
## distributed under the License is distributed on an "AS IS" BASIS, |
|
19
|
|
|
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
20
|
|
|
## See the License for the specific language governing permissions and |
|
21
|
|
|
## limitations under the License. |
|
22
|
|
|
################################################# |
|
23
|
|
|
|
|
24
|
|
|
use PHPLicengine\Api\ApiInterface; |
|
25
|
|
|
use PHPLicengine\Service\Organization; |
|
26
|
|
|
use PHPUnit\Framework\TestCase; |
|
27
|
|
|
|
|
28
|
|
|
class OrganizationTest extends TestCase |
|
29
|
|
|
{ |
|
30
|
|
|
|
|
31
|
|
|
public function testGetOrganizations() |
|
32
|
|
|
{ |
|
33
|
|
|
$mock = $this->createMock(ApiInterface::class); |
|
34
|
|
|
$mock |
|
35
|
|
|
->expects($this->once()) |
|
36
|
|
|
->method('get') |
|
37
|
|
|
->with( |
|
38
|
|
|
$this->equalTo('https://api-ssl.bitly.com/v4/organizations') |
|
39
|
|
|
); |
|
40
|
|
|
$bitlink = new Organization($mock); |
|
41
|
|
|
$bitlink->getOrganizations(); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function testGetOrganizationShortenCounts() |
|
45
|
|
|
{ |
|
46
|
|
|
$mock = $this->createMock(ApiInterface::class); |
|
47
|
|
|
$mock |
|
48
|
|
|
->expects($this->once()) |
|
49
|
|
|
->method('get') |
|
50
|
|
|
->with( |
|
51
|
|
|
$this->equalTo('https://api-ssl.bitly.com/v4/organizations/test/shorten_counts') |
|
52
|
|
|
); |
|
53
|
|
|
$bitlink = new Organization($mock); |
|
54
|
|
|
$bitlink->getOrganizationShortenCounts('test'); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function testGetOrganization() |
|
58
|
|
|
{ |
|
59
|
|
|
$mock = $this->createMock(ApiInterface::class); |
|
60
|
|
|
$mock |
|
61
|
|
|
->expects($this->once()) |
|
62
|
|
|
->method('get') |
|
63
|
|
|
->with( |
|
64
|
|
|
$this->equalTo('https://api-ssl.bitly.com/v4/organizations/test') |
|
65
|
|
|
); |
|
66
|
|
|
$bitlink = new Organization($mock); |
|
67
|
|
|
$bitlink->getOrganization('test'); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
} |
|
71
|
|
|
|