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 | /** |
||
4 | * @file |
||
5 | * Grafizzi\Graph\Tests\IG17Test: a component of the Grafizzi library. |
||
6 | * |
||
7 | * (c) 2012 Frédéric G. MARAND <[email protected]> |
||
8 | * |
||
9 | * Grafizzi is free software: you can redistribute it and/or modify it under the |
||
10 | * terms of the GNU Lesser General Public License as published by the Free |
||
11 | * Software Foundation, either version 3 of the License, or (at your option) any |
||
12 | * later version. |
||
13 | * |
||
14 | * Grafizzi is distributed in the hope that it will be useful, but WITHOUT ANY |
||
15 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
||
16 | * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
||
17 | * details. |
||
18 | * |
||
19 | * You should have received a copy of the GNU Lesser General Public License |
||
20 | * along with Grafizzi, in the COPYING.LESSER.txt file. If not, see |
||
21 | * <http://www.gnu.org/licenses/> |
||
22 | */ |
||
23 | |||
24 | namespace Grafizzi\Graph\Tests; |
||
25 | |||
26 | use Grafizzi\Graph\Attribute; |
||
27 | use Grafizzi\Graph\Cluster; |
||
28 | use Grafizzi\Graph\Edge; |
||
29 | use Grafizzi\Graph\Node; |
||
30 | |||
31 | require 'vendor/autoload.php'; |
||
32 | |||
33 | /** |
||
34 | * A recreation of Image_GraphViz test17.phpt |
||
35 | * |
||
36 | * Image_GraphViz version author: Philippe Jausions <[email protected]> |
||
37 | * |
||
38 | * Test 17: "Process diagram with clusters" |
||
39 | * |
||
40 | * "Graph definition taken from GraphViz documentation" |
||
41 | * |
||
42 | * Note: ordering of insertions differs from Image_GraphViz, since Grafizzi |
||
43 | * orders output by insertion order to allow customizing output order. |
||
44 | */ |
||
45 | class IG17Test extends BaseGraphTest { |
||
46 | |||
47 | public function setUp() : void { |
||
48 | // not strict by default. |
||
49 | parent::setUpExtended(); |
||
0 ignored issues
–
show
|
|||
50 | $g = $this->Graph; |
||
51 | $dic = $this->dic; |
||
52 | $g->setDirected(true); |
||
53 | |||
54 | $nullTitle = array(new Attribute($dic, 'title', NULL)); |
||
55 | |||
56 | // Global |
||
57 | $g->addChild($start = new Node($dic, 'start', array( |
||
58 | new Attribute($dic, 'shape', 'Mdiamond'), |
||
59 | ))); |
||
60 | $g->addChild($end = new Node($dic, 'end', array( |
||
61 | new Attribute($dic, 'shape', 'Msquare'), |
||
62 | ))); |
||
63 | |||
64 | $nodes = array(); |
||
65 | |||
66 | // cluster0 |
||
67 | $g->addChild($cluster0 = new Cluster($dic, 0, array( |
||
68 | new Attribute($dic, 'style', 'filled'), |
||
69 | new Attribute($dic, 'color', 'lightgrey'), |
||
70 | new Attribute($dic, 'label', 'process #1'), |
||
71 | ))); |
||
72 | View Code Duplication | for ($i = 0 ; $i < 4 ; $i++) { |
|
0 ignored issues
–
show
This code seems to be duplicated across 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. ![]() |
|||
73 | $nodeName = "a$i"; |
||
74 | $cluster0->addChild($nodes[$nodeName] = new Node($dic, $nodeName, $nullTitle)); |
||
75 | } |
||
76 | |||
77 | // cluster1 |
||
78 | $g->addChild($cluster1 = new Cluster($dic, 1, array( |
||
79 | new Attribute($dic, 'color', 'blue'), |
||
80 | new Attribute($dic, 'label', 'process #2'), |
||
81 | ))); |
||
82 | View Code Duplication | for ($i = 0 ; $i < 4 ; $i++) { |
|
0 ignored issues
–
show
This code seems to be duplicated across 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. ![]() |
|||
83 | $nodeName = "b$i"; |
||
84 | $cluster1->addChild($nodes[$nodeName] = new Node($dic, $nodeName, $nullTitle)); |
||
85 | } |
||
86 | |||
87 | $g->addChild(new Edge($dic, $nodes['a0'], $nodes['a1'])); |
||
88 | $g->addChild(new Edge($dic, $nodes['a1'], $nodes['a2'])); |
||
89 | $g->addChild(new Edge($dic, $nodes['a1'], $nodes['b3'])); |
||
90 | $g->addChild(new Edge($dic, $nodes['a2'], $nodes['a3'])); |
||
91 | $g->addChild(new Edge($dic, $nodes['b0'], $nodes['b1'])); |
||
92 | $g->addChild(new Edge($dic, $nodes['b1'], $nodes['b2'])); |
||
93 | $g->addChild(new Edge($dic, $nodes['b2'], $nodes['b3'])); |
||
94 | $g->addChild(new Edge($dic, $nodes['b2'], $nodes['a3'])); |
||
95 | |||
96 | $g->addChild(new Edge($dic, $start, $nodes['a0'])); |
||
97 | $g->addChild(new Edge($dic, $start, $nodes['b0'])); |
||
98 | |||
99 | $g->addChild(new Edge($dic, $nodes['a3'], $nodes['a0'])); |
||
100 | $g->addChild(new Edge($dic, $nodes['a3'], $end)); |
||
101 | $g->addChild(new Edge($dic, $nodes['b3'], $end)); |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * Tests g->build() |
||
106 | */ |
||
107 | public function testBuild() { |
||
108 | $expected = <<<'EOT' |
||
109 | digraph G { |
||
110 | start [ shape=Mdiamond ]; |
||
111 | end [ shape=Msquare ]; |
||
112 | subgraph cluster_0 { |
||
113 | style=filled; |
||
114 | color=lightgrey; |
||
115 | label="process #1"; |
||
116 | |||
117 | a0; |
||
118 | a1; |
||
119 | a2; |
||
120 | a3; |
||
121 | } /* /subgraph cluster_0 */ |
||
122 | subgraph cluster_1 { |
||
123 | color=blue; |
||
124 | label="process #2"; |
||
125 | |||
126 | b0; |
||
127 | b1; |
||
128 | b2; |
||
129 | b3; |
||
130 | } /* /subgraph cluster_1 */ |
||
131 | a0 -> a1; |
||
132 | a1 -> a2; |
||
133 | a1 -> b3; |
||
134 | a2 -> a3; |
||
135 | b0 -> b1; |
||
136 | b1 -> b2; |
||
137 | b2 -> b3; |
||
138 | b2 -> a3; |
||
139 | start -> a0; |
||
140 | start -> b0; |
||
141 | a3 -> a0; |
||
142 | a3 -> end; |
||
143 | b3 -> end; |
||
144 | } /* /digraph G */ |
||
145 | |||
146 | EOT; |
||
147 | $this->check($expected, "Image_graphViz test 17 passed."); |
||
148 | } |
||
149 | } |
||
150 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.