This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * phpDocumentor |
||
4 | * |
||
5 | * PHP Version 5.3 |
||
6 | * |
||
7 | * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) |
||
8 | * @license http://www.opensource.org/licenses/mit-license.php MIT |
||
9 | * @link http://phpdoc.org |
||
10 | */ |
||
11 | |||
12 | namespace phpDocumentor\Descriptor\Filter; |
||
13 | |||
14 | use \Mockery as m; |
||
15 | use phpDocumentor\Descriptor\ProjectDescriptorBuilder; |
||
16 | |||
17 | /** |
||
18 | * Tests the functionality for the StripInternal class. |
||
19 | */ |
||
20 | class StripInternalTest extends \Mockery\Adapter\Phpunit\MockeryTestCase |
||
21 | { |
||
22 | /** @var ProjectDescriptorBuilder|m\Mock */ |
||
23 | protected $builderMock; |
||
24 | |||
25 | /** @var StripInternal $fixture */ |
||
26 | protected $fixture; |
||
27 | |||
28 | /** |
||
29 | * Creates a new (empty) fixture object. |
||
30 | */ |
||
31 | protected function setUp() |
||
32 | { |
||
33 | $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); |
||
34 | $this->fixture = new StripInternal($this->builderMock); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @covers phpDocumentor\Descriptor\Filter\StripInternal::__construct |
||
39 | */ |
||
40 | public function testProjectDescriptorBuilderIsSetUponConstruction() |
||
41 | { |
||
42 | $this->assertAttributeSame($this->builderMock, 'builder', $this->fixture); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @covers phpDocumentor\Descriptor\Filter\StripInternal::__invoke |
||
47 | */ |
||
48 | public function testStripsInternalTagFromDescription() |
||
49 | { |
||
50 | $this->builderMock->shouldReceive('getProjectDescriptor->isVisibilityAllowed')->andReturn(false); |
||
0 ignored issues
–
show
|
|||
51 | $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); |
||
52 | $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(null); |
||
53 | |||
54 | $descriptor->shouldReceive('getDescription')->andReturn('without {@internal blabla }}internal tag'); |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
Loading history...
|
|||
55 | $descriptor->shouldReceive('setDescription')->with('without internal tag'); |
||
56 | |||
57 | $this->assertSame($descriptor, $this->fixture->__invoke($descriptor)); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @covers phpDocumentor\Descriptor\Filter\StripInternal::__invoke |
||
62 | */ |
||
63 | public function testStripsInternalTagFromDescriptionIfTagDescriptionContainsBraces() |
||
64 | { |
||
65 | $this->builderMock->shouldReceive('getProjectDescriptor->isVisibilityAllowed')->andReturn(false); |
||
0 ignored issues
–
show
The method
shouldReceive does only exist in Mockery\Mock , but not in phpDocumentor\Descriptor\ProjectDescriptorBuilder .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
Loading history...
|
|||
66 | $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); |
||
67 | $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(null); |
||
68 | |||
69 | $descriptor->shouldReceive('getDescription')->andReturn('without {@internal bla{bla} }}internal tag'); |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
Loading history...
|
|||
70 | $descriptor->shouldReceive('setDescription')->with('without internal tag'); |
||
71 | |||
72 | $this->assertSame($descriptor, $this->fixture->__invoke($descriptor)); |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * @covers phpDocumentor\Descriptor\Filter\StripInternal::__invoke |
||
77 | */ |
||
78 | public function testResolvesInternalTagFromDescriptionIfParsePrivateIsTrue() |
||
79 | { |
||
80 | $this->builderMock->shouldReceive('getProjectDescriptor->isVisibilityAllowed')->andReturn(true); |
||
0 ignored issues
–
show
The method
shouldReceive does only exist in Mockery\Mock , but not in phpDocumentor\Descriptor\ProjectDescriptorBuilder .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
Loading history...
|
|||
81 | $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); |
||
82 | |||
83 | $descriptor->shouldReceive('getDescription')->andReturn('without {@internal blabla }}internal tag'); |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
Loading history...
|
|||
84 | $descriptor->shouldReceive('setDescription')->with('without blabla internal tag'); |
||
85 | |||
86 | $this->assertSame($descriptor, $this->fixture->__invoke($descriptor)); |
||
87 | } |
||
88 | |||
89 | /** |
||
90 | * @covers phpDocumentor\Descriptor\Filter\StripInternal::__invoke |
||
91 | */ |
||
92 | public function testRemovesDescriptorIfTaggedAsInternal() |
||
93 | { |
||
94 | $this->builderMock->shouldReceive('getProjectDescriptor->isVisibilityAllowed')->andReturn(false); |
||
0 ignored issues
–
show
The method
shouldReceive does only exist in Mockery\Mock , but not in phpDocumentor\Descriptor\ProjectDescriptorBuilder .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
Loading history...
|
|||
95 | |||
96 | $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); |
||
97 | $descriptor->shouldReceive('getDescription'); |
||
98 | $descriptor->shouldReceive('setDescription'); |
||
99 | $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(true); |
||
100 | |||
101 | $this->assertNull($this->fixture->__invoke($descriptor)); |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * @covers phpDocumentor\Descriptor\Filter\StripInternal::__invoke |
||
106 | */ |
||
107 | public function testKeepsDescriptorIfTaggedAsInternalAndParsePrivateIsTrue() |
||
108 | { |
||
109 | $this->builderMock->shouldReceive('getProjectDescriptor->isVisibilityAllowed')->andReturn(true); |
||
0 ignored issues
–
show
The method
shouldReceive does only exist in Mockery\Mock , but not in phpDocumentor\Descriptor\ProjectDescriptorBuilder .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
Loading history...
|
|||
110 | |||
111 | $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); |
||
112 | $descriptor->shouldReceive('getDescription'); |
||
113 | $descriptor->shouldReceive('setDescription'); |
||
114 | $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(true); |
||
115 | |||
116 | $this->assertSame($descriptor, $this->fixture->__invoke($descriptor)); |
||
117 | } |
||
118 | |||
119 | /** |
||
120 | * @covers phpDocumentor\Descriptor\Filter\StripInternal::__invoke |
||
121 | */ |
||
122 | public function testDescriptorIsUnmodifiedIfThereIsNoInternalTag() |
||
123 | { |
||
124 | $this->builderMock->shouldReceive('getProjectDescriptor->isVisibilityAllowed')->andReturn(true); |
||
0 ignored issues
–
show
The method
shouldReceive does only exist in Mockery\Mock , but not in phpDocumentor\Descriptor\ProjectDescriptorBuilder .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
Loading history...
|
|||
125 | |||
126 | $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); |
||
127 | $descriptor->shouldReceive('getDescription'); |
||
128 | $descriptor->shouldReceive('setDescription'); |
||
129 | $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(false); |
||
130 | |||
131 | $this->assertEquals($descriptor, $this->fixture->__invoke($descriptor)); |
||
132 | } |
||
133 | } |
||
134 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: