Completed
Push — master ( efcd9d...99efad )
by PHPLicengine
08:21 queued 02:36
created

UserTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 2
1
<?php
2
3
// UserTest.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\User;
26
use PHPUnit\Framework\TestCase;
27
28
class UserTest extends TestCase
29
{
30
    
31
    public function testUpdateUser()
32
    {
33
        $mock = $this->createMock(ApiInterface::class);
34
        $mock
35
            ->expects($this->once())
36
            ->method('patch')
37
            ->with(
38
                    $this->equalTo('https://api-ssl.bitly.com/v4/user'),
39
                    $this->identicalTo(['key' => 'value'])
40
                    );
41
        $bitlink = new User($mock);
42
        $bitlink->updateUser(['key' => 'value']);
43
    } 
44
45
    public function testGetUser()
46
    {
47
        $mock = $this->createMock(ApiInterface::class);
48
        $mock
49
            ->expects($this->once())
50
            ->method('get')
51
            ->with(
52
                    $this->equalTo('https://api-ssl.bitly.com/v4/user')
53
                  );
54
        $bitlink = new User($mock);
55
        $bitlink->getUser();
56
    } 
57
58
}
59