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.

ResourceCollectionTest::testGetItems()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace prgTW\BaseCRM\Tests\Resource;
4
5
use prgTW\BaseCRM\Resource\ResourceCollection;
6
use prgTW\BaseCRM\Service\Account;
7
use prgTW\BaseCRM\Service\Source;
8
use prgTW\BaseCRM\Transport\Transport;
9
10
class ResourceCollectionTest extends \PHPUnit_Framework_TestCase
11
{
12
	/** @var array|Resource[] */
13
	protected $resources;
14
15
	/** @var ResourceCollection */
16
	protected $collection;
17
18
	public function testGetItems()
19
	{
20
		$this->assertEquals($this->resources, $this->collection->getItems());
21
	}
22
23
	public function testArrayAccess()
24
	{
25
		$this->assertCount(3, $this->collection);
26
27
		foreach ([0, 1, 2] as $key)
28
		{
29
			$this->assertTrue(isset($this->collection[$key]));
30
			$this->assertInstanceOf(Account::class, $this->collection[$key]);
31
			$this->collection[$key] = new Source(\Mockery::mock(Transport::class), '');
32
			$this->assertInstanceOf(Source::class, $this->collection[$key]);
33
		}
34
35
		unset($this->collection[2]);
36
		unset($this->collection[1]);
37
		unset($this->collection[0]);
38
39
		$this->assertCount(0, $this->collection);
40
		$this->assertNull($this->collection->key());
41
	}
42
43
	public function testIterator()
44
	{
45
		foreach ($this->collection as $resource)
46
		{
47
			$this->assertInstanceOf(Account::class, $resource);
48
		}
49
	}
50
51
	protected function setUp()
52
	{
53
		$client           = \Mockery::mock(Transport::class);
54
		$this->resources  = [
55
			new Account($client, ''),
56
			new Account($client, ''),
57
			new Account($client, ''),
58
		];
59
		$this->collection = new ResourceCollection($this->resources);
60
	}
61
}
62