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 | namespace spec\Prophecy\Argument; |
||
4 | |||
5 | use PhpSpec\ObjectBehavior; |
||
6 | use Prophecy\Argument\Token\TokenInterface; |
||
7 | |||
8 | class ArgumentsWildcardSpec extends ObjectBehavior |
||
9 | { |
||
10 | function it_wraps_non_token_arguments_into_ExactValueToken(\stdClass $object) |
||
11 | { |
||
12 | $this->beConstructedWith(array(42, 'zet', $object)); |
||
13 | |||
14 | $class = get_class($object->getWrappedObject()); |
||
15 | $hash = spl_object_hash($object->getWrappedObject()); |
||
16 | |||
17 | $objHash = "exact(42), exact(\"zet\"), exact($class:$hash Object (\n 'objectProphecyClosure' => Closure:%s Object (\n 0 => Closure:%s Object\n )\n))"; |
||
18 | |||
19 | $hashRegexExpr = '[a-f0-9]{32}'; |
||
20 | $this->__toString()->shouldMatch(sprintf('/^%s$/', sprintf(preg_quote("$objHash"), $hashRegexExpr, $hashRegexExpr))); |
||
21 | } |
||
22 | |||
23 | View Code Duplication | function it_generates_string_representation_from_all_tokens_imploded( |
|
0 ignored issues
–
show
|
|||
24 | TokenInterface $token1, |
||
25 | TokenInterface $token2, |
||
26 | TokenInterface $token3 |
||
27 | ) { |
||
28 | $token1->__toString()->willReturn('token_1'); |
||
29 | $token2->__toString()->willReturn('token_2'); |
||
30 | $token3->__toString()->willReturn('token_3'); |
||
31 | |||
32 | $this->beConstructedWith(array($token1, $token2, $token3)); |
||
33 | $this->__toString()->shouldReturn('token_1, token_2, token_3'); |
||
34 | } |
||
35 | |||
36 | function it_exposes_list_of_tokens(TokenInterface $token) |
||
37 | { |
||
38 | $this->beConstructedWith(array($token)); |
||
39 | |||
40 | $this->getTokens()->shouldReturn(array($token)); |
||
41 | } |
||
42 | |||
43 | function it_returns_score_of_1_if_there_are_no_tokens_and_arguments() |
||
44 | { |
||
45 | $this->beConstructedWith(array()); |
||
46 | |||
47 | $this->scoreArguments(array())->shouldReturn(1); |
||
48 | } |
||
49 | |||
50 | View Code Duplication | function it_should_return_match_score_based_on_all_tokens_score( |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
51 | TokenInterface $token1, |
||
52 | TokenInterface $token2, |
||
53 | TokenInterface $token3 |
||
54 | ) { |
||
55 | $token1->scoreArgument('one')->willReturn(3); |
||
56 | $token1->isLast()->willReturn(false); |
||
57 | $token2->scoreArgument(2)->willReturn(5); |
||
58 | $token2->isLast()->willReturn(false); |
||
59 | $token3->scoreArgument($obj = new \stdClass())->willReturn(10); |
||
60 | $token3->isLast()->willReturn(false); |
||
61 | |||
62 | $this->beConstructedWith(array($token1, $token2, $token3)); |
||
63 | $this->scoreArguments(array('one', 2, $obj))->shouldReturn(18); |
||
64 | } |
||
65 | |||
66 | View Code Duplication | function it_returns_false_if_there_is_less_arguments_than_tokens( |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
67 | TokenInterface $token1, |
||
68 | TokenInterface $token2, |
||
69 | TokenInterface $token3 |
||
70 | ) { |
||
71 | $token1->scoreArgument('one')->willReturn(3); |
||
72 | $token1->isLast()->willReturn(false); |
||
73 | $token2->scoreArgument(2)->willReturn(5); |
||
74 | $token2->isLast()->willReturn(false); |
||
75 | $token3->scoreArgument(null)->willReturn(false); |
||
76 | $token3->isLast()->willReturn(false); |
||
77 | |||
78 | $this->beConstructedWith(array($token1, $token2, $token3)); |
||
79 | $this->scoreArguments(array('one', 2))->shouldReturn(false); |
||
80 | } |
||
81 | |||
82 | View Code Duplication | function it_returns_false_if_there_is_less_tokens_than_arguments( |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
83 | TokenInterface $token1, |
||
84 | TokenInterface $token2, |
||
85 | TokenInterface $token3 |
||
86 | ) { |
||
87 | $token1->scoreArgument('one')->willReturn(3); |
||
88 | $token1->isLast()->willReturn(false); |
||
89 | $token2->scoreArgument(2)->willReturn(5); |
||
90 | $token2->isLast()->willReturn(false); |
||
91 | $token3->scoreArgument($obj = new \stdClass())->willReturn(10); |
||
92 | $token3->isLast()->willReturn(false); |
||
93 | |||
94 | $this->beConstructedWith(array($token1, $token2, $token3)); |
||
95 | $this->scoreArguments(array('one', 2, $obj, 4))->shouldReturn(false); |
||
96 | } |
||
97 | |||
98 | View Code Duplication | function it_should_return_false_if_one_of_the_tokens_returns_false( |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
99 | TokenInterface $token1, |
||
100 | TokenInterface $token2, |
||
101 | TokenInterface $token3 |
||
102 | ) { |
||
103 | $token1->scoreArgument('one')->willReturn(3); |
||
104 | $token1->isLast()->willReturn(false); |
||
105 | $token2->scoreArgument(2)->willReturn(false); |
||
106 | $token2->isLast()->willReturn(false); |
||
107 | $token3->scoreArgument($obj = new \stdClass())->willReturn(10); |
||
108 | $token3->isLast()->willReturn(false); |
||
109 | |||
110 | $this->beConstructedWith(array($token1, $token2, $token3)); |
||
111 | $this->scoreArguments(array('one', 2, $obj))->shouldReturn(false); |
||
112 | } |
||
113 | |||
114 | View Code Duplication | function it_should_calculate_score_until_last_token( |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
115 | TokenInterface $token1, |
||
116 | TokenInterface $token2, |
||
117 | TokenInterface $token3 |
||
118 | ) { |
||
119 | $token1->scoreArgument('one')->willReturn(3); |
||
120 | $token1->isLast()->willReturn(false); |
||
121 | |||
122 | $token2->scoreArgument(2)->willReturn(7); |
||
123 | $token2->isLast()->willReturn(true); |
||
124 | |||
125 | $token3->scoreArgument($obj = new \stdClass())->willReturn(10); |
||
126 | $token3->isLast()->willReturn(false); |
||
127 | |||
128 | $this->beConstructedWith(array($token1, $token2, $token3)); |
||
129 | $this->scoreArguments(array('one', 2, $obj))->shouldReturn(10); |
||
130 | } |
||
131 | } |
||
132 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.