GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 556562...8743ff )
by Casper
07:04 queued 05:11
created

CollectionsTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 29
c 1
b 0
f 0
dl 0
loc 53
rs 10
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testViewItem() 0 6 1
A testDeleteItem() 0 10 1
A testCreateItem() 0 6 1
A testView() 0 14 3
A testUpdateItem() 0 6 1
1
<?php
2
3
namespace NStack\Tests;
4
5
use NStack\Clients\CollectionsClient;
6
use NStack\Tests\objects\CollectionItem;
7
use NStack\Tests\objects\CollectionShow1;
8
use NStack\Tests\objects\CollectionShow2;
9
10
class CollectionsTest extends TestCase
11
{
12
    public function testView()
13
    {
14
        $client = $this->getClientWithMockedGet('collection-show-1.json');
15
        $client = new CollectionsClient($this->getConfig(), $client);
16
        $entry = $client->view(10);
17
        foreach ($entry as $item) {
18
            $this->assertInstanceOf(CollectionShow1::class, new CollectionShow1($item));
19
        }
20
21
        $client = $this->getClientWithMockedGet('collection-show-2.json');
22
        $client = new CollectionsClient($this->getConfig(), $client);
23
        $entry = $client->view(10);
24
        foreach ($entry as $item) {
25
            $this->assertInstanceOf(CollectionShow2::class, new CollectionShow2($item));
26
        }
27
    }
28
29
    public function testCreateItem()
30
    {
31
        $client = $this->getClientWithMockedPost('collection-create-item.json');
32
        $client = new CollectionsClient($this->getConfig(), $client);
33
        $entry = $client->createItem(10, ["id" => 39, "key" => "41"]);
34
        $this->assertInstanceOf(CollectionItem::class, new CollectionItem($entry));
35
    }
36
37
    public function testDeleteItem()
38
    {
39
        $mock = $this->getMockBuilder('CollectionsClient')
40
            ->setMethods(array('delete'))
41
            ->getMock();
42
43
        $mock->expects($this->once())
44
            ->method('delete');
45
46
        $mock->delete(10, 15);
47
    }
48
49
    public function testUpdateItem()
50
    {
51
        $client = $this->getClientWithMockedPost('collection-update-item.json');
52
        $client = new CollectionsClient($this->getConfig(), $client);
53
        $entry = $client->updateItem(10, 315, ["id" => 39, "key" => "50"]);
54
        $this->assertInstanceOf(CollectionItem::class, new CollectionItem($entry));
55
    }
56
57
    public function testViewItem()
58
    {
59
        $client = $this->getClientWithMockedGet('collection-show-item.json');
60
        $client = new CollectionsClient($this->getConfig(), $client);
61
        $entry = $client->viewItem(39, 315);
62
        $this->assertInstanceOf(CollectionItem::class, new CollectionItem($entry));
63
    }
64
}
65