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.

NotesTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 7
dl 0
loc 41
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B testGet() 0 38 1
1
<?php
2
3
namespace prgTW\BaseCRM\Tests\Service;
4
5
use prgTW\BaseCRM\BaseCrm;
6
use prgTW\BaseCRM\Client\GuzzleClient;
7
use prgTW\BaseCRM\Resource\Resource;
8
use prgTW\BaseCRM\Service\Contact;
9
use prgTW\BaseCRM\Service\Note;
10
use prgTW\BaseCRM\Tests\AbstractTest;
11
12
class NotesTest extends AbstractTest
13
{
14
	public function testGet()
15
	{
16
		$client = \Mockery::mock(GuzzleClient::class);
17
		$client
18
			->shouldReceive('request')
19
			->once()
20
			->with('GET', sprintf('%s/%s/contacts/1/notes.json', Resource::ENDPOINT_SALES, Resource::PREFIX), $this->getQuery())
21
			->andReturn($this->getResponse(200, '
22
				[
23
					{
24
						"note": {
25
							"created_at": "2011-08-19T15:54:16Z",
26
							"updated_at": "2011-08-19T15:54:16Z",
27
							"contact_id": 579,
28
							"username": "User 1",
29
							"id": 89,
30
							"content": "Some note",
31
							"deal_id": 0
32
						}
33
					}
34
				]
35
			'));
36
37
		$baseCrm = new BaseCrm('', $client);
38
		/** @var Contact $contact */
39
		$contact = $baseCrm->getContacts()->get(1);
40
		$notes   = $contact->getNotes();
41
		$this->assertCount(1, $notes);
42
		$note = $notes[0];
43
		$this->assertInstanceOf(Note::class, $note);
44
		$this->assertEquals('2011-08-19T15:54:16Z', $note->created_at);
45
		$this->assertEquals('2011-08-19T15:54:16Z', $note->updated_at);
46
		$this->assertEquals(579, $note->contact_id);
47
		$this->assertEquals('User 1', $note->username);
48
		$this->assertEquals(89, $note->id);
49
		$this->assertEquals("Some note", $note->content);
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal Some note does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
50
		$this->assertEquals(0, $note->deal_id);
51
	}
52
}
53