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.

testRepresentation()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 31
rs 8.8571
cc 1
eloc 13
nc 1
nop 0
1
<?php
2
3
namespace prgTW\BaseCRM\Tests\Error;
4
5
use GuzzleHttp\Message\Request;
6
use GuzzleHttp\Message\Response;
7
use GuzzleHttp\Stream\Stream;
8
use prgTW\BaseCRM\Exception\RepresentationErrorException;
9
10
class RepresentationErrorExceptionTest extends \PHPUnit_Framework_TestCase
11
{
12
	public function testRepresentation()
13
	{
14
		$stream   = Stream::factory('{
15
			"errors": {
16
				"contact": [
17
					{
18
						"error": {
19
							"code": "E0001",
20
							"field": "last_name",
21
							"description": "Please provide contact\'s last name."
22
						}
23
					}
24
				]
25
			}
26
		}');
27
		$response = new Response(422, [], $stream);
28
29
		$exception = new RepresentationErrorException('', new Request('POST', ''), $response);
30
31
		$this->assertTrue($exception->hasErrors());
32
		$this->assertTrue($exception->hasErrors('last_name'));
33
		$this->assertFalse($exception->hasErrors('non_existing'));
34
35
		$this->assertCount(1, $exception->getErrors());
36
		$this->assertCount(1, $exception->getErrors('last_name'));
37
		$this->assertCount(0, $exception->getErrors('non_existing'));
38
39
		$this->assertEquals('E0001', $exception->getErrors()[0]->getCode());
40
		$this->assertEquals('last_name', $exception->getErrors()[0]->getField());
41
		$this->assertEquals('Please provide contact\'s last name.', $exception->getErrors()[0]->getDescription());
42
	}
43
}
44