1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use RingCentral\Psr7\ServerRequest; |
4
|
|
|
|
5
|
|
|
class ServerRequestTest extends \PHPUnit_Framework_TestCase |
|
|
|
|
6
|
|
|
{ |
7
|
|
|
private $request; |
8
|
|
|
|
9
|
|
|
public function setUp() |
10
|
|
|
{ |
11
|
|
|
$this->request = new ServerRequest('GET', 'http://localhost'); |
12
|
|
|
} |
13
|
|
|
|
14
|
|
|
public function testGetNoAttributes() |
15
|
|
|
{ |
16
|
|
|
$this->assertEquals(array(), $this->request->getAttributes()); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public function testWithAttribute() |
20
|
|
|
{ |
21
|
|
|
$request = $this->request->withAttribute('hello', 'world'); |
22
|
|
|
|
23
|
|
|
$this->assertNotSame($request, $this->request); |
24
|
|
|
$this->assertEquals(array('hello' => 'world'), $request->getAttributes()); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function testGetAttribute() |
28
|
|
|
{ |
29
|
|
|
$request = $this->request->withAttribute('hello', 'world'); |
30
|
|
|
|
31
|
|
|
$this->assertNotSame($request, $this->request); |
32
|
|
|
$this->assertEquals('world', $request->getAttribute('hello')); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function testGetDefaultAttribute() |
36
|
|
|
{ |
37
|
|
|
$request = $this->request->withAttribute('hello', 'world'); |
38
|
|
|
|
39
|
|
|
$this->assertNotSame($request, $this->request); |
40
|
|
|
$this->assertEquals(null, $request->getAttribute('hi', null)); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function testWithoutAttribute() |
44
|
|
|
{ |
45
|
|
|
$request = $this->request->withAttribute('hello', 'world'); |
46
|
|
|
$request = $request->withAttribute('test', 'nice'); |
47
|
|
|
|
48
|
|
|
$request = $request->withoutAttribute('hello'); |
49
|
|
|
|
50
|
|
|
$this->assertNotSame($request, $this->request); |
51
|
|
|
$this->assertEquals(array('test' => 'nice'), $request->getAttributes()); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function testWithCookieParams() |
55
|
|
|
{ |
56
|
|
|
$request = $this->request->withCookieParams(array('test' => 'world')); |
57
|
|
|
|
58
|
|
|
$this->assertNotSame($request, $this->request); |
59
|
|
|
$this->assertEquals(array('test' => 'world'), $request->getCookieParams()); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function testWithQueryParams() |
63
|
|
|
{ |
64
|
|
|
$request = $this->request->withQueryParams(array('test' => 'world')); |
65
|
|
|
|
66
|
|
|
$this->assertNotSame($request, $this->request); |
67
|
|
|
$this->assertEquals(array('test' => 'world'), $request->getQueryParams()); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function testWithUploadedFiles() |
71
|
|
|
{ |
72
|
|
|
$request = $this->request->withUploadedFiles(array('test' => 'world')); |
73
|
|
|
|
74
|
|
|
$this->assertNotSame($request, $this->request); |
75
|
|
|
$this->assertEquals(array('test' => 'world'), $request->getUploadedFiles()); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function testWithParsedBody() |
79
|
|
|
{ |
80
|
|
|
$request = $this->request->withParsedBody(array('test' => 'world')); |
81
|
|
|
|
82
|
|
|
$this->assertNotSame($request, $this->request); |
83
|
|
|
$this->assertEquals(array('test' => 'world'), $request->getParsedBody()); |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths