11<?php
2+
23namespace Mouf \Database \SchemaAnalyzer ;
34
4- use Doctrine \Common \Cache \ArrayCache ;
5- use Doctrine \DBAL \Schema \Schema ;
65use Fhaculty \Graph \Graph ;
76use Fhaculty \Graph \Vertex ;
87use Fhaculty \Graph \Edge ;
98
109class MultiDijkstraTest extends \PHPUnit_Framework_TestCase
1110{
12- public function testDijkstra () {
11+ public function testDijkstra ()
12+ {
1313 $ graph = new Graph ();
1414
15- $ a = $ graph ->createVertex (" a " );
16- $ b = $ graph ->createVertex (" b " );
17- $ c = $ graph ->createVertex (" c " );
18- $ d = $ graph ->createVertex (" d " );
19- $ e = $ graph ->createVertex (" e " );
20- $ f = $ graph ->createVertex (" f " );
21- $ g = $ graph ->createVertex (" g " );
22- $ h = $ graph ->createVertex (" h " );
23- $ i = $ graph ->createVertex (" i " );
24- $ j = $ graph ->createVertex (" j " );
15+ $ a = $ graph ->createVertex (' a ' );
16+ $ b = $ graph ->createVertex (' b ' );
17+ $ c = $ graph ->createVertex (' c ' );
18+ $ d = $ graph ->createVertex (' d ' );
19+ $ e = $ graph ->createVertex (' e ' );
20+ $ f = $ graph ->createVertex (' f ' );
21+ $ g = $ graph ->createVertex (' g ' );
22+ $ h = $ graph ->createVertex (' h ' );
23+ $ i = $ graph ->createVertex (' i ' );
24+ $ j = $ graph ->createVertex (' j ' );
2525
2626 $ a ->createEdge ($ b )->setWeight (85 );
2727 $ a ->createEdge ($ c )->setWeight (217 );
@@ -50,13 +50,14 @@ public function testDijkstra() {
5050 /**
5151 * @expectedException \Mouf\Database\SchemaAnalyzer\MultiDijkstraAmbiguityException
5252 */
53- public function testDijkstraAmbiguity () {
53+ public function testDijkstraAmbiguity ()
54+ {
5455 $ graph = new Graph ();
5556
56- $ a = $ graph ->createVertex (" a " );
57- $ b = $ graph ->createVertex (" b " );
58- $ c = $ graph ->createVertex (" c " );
59- $ d = $ graph ->createVertex (" d " );
57+ $ a = $ graph ->createVertex (' a ' );
58+ $ b = $ graph ->createVertex (' b ' );
59+ $ c = $ graph ->createVertex (' c ' );
60+ $ d = $ graph ->createVertex (' d ' );
6061
6162 $ a ->createEdge ($ b )->setWeight (12 );
6263 $ a ->createEdge ($ c )->setWeight (42 );
@@ -71,13 +72,14 @@ public function testDijkstraAmbiguity() {
7172 /**
7273 * @expectedException \Mouf\Database\SchemaAnalyzer\MultiDijkstraNoPathException
7374 */
74- public function testDijkstraNoPath () {
75+ public function testDijkstraNoPath ()
76+ {
7577 $ graph = new Graph ();
7678
77- $ a = $ graph ->createVertex (" a " );
78- $ b = $ graph ->createVertex (" b " );
79- $ c = $ graph ->createVertex (" c " );
80- $ d = $ graph ->createVertex (" d " );
79+ $ a = $ graph ->createVertex (' a ' );
80+ $ b = $ graph ->createVertex (' b ' );
81+ $ c = $ graph ->createVertex (' c ' );
82+ $ d = $ graph ->createVertex (' d ' );
8183
8284 $ a ->createEdge ($ b )->setWeight (12 );
8385 $ a ->createEdge ($ c )->setWeight (42 );
@@ -88,30 +90,32 @@ public function testDijkstraNoPath() {
8890 /**
8991 * @expectedException \Fhaculty\Graph\Exception\UnexpectedValueException
9092 */
91- public function testDijkstraNegativeWeight () {
93+ public function testDijkstraNegativeWeight ()
94+ {
9295 $ graph = new Graph ();
9396
94- $ a = $ graph ->createVertex (" a " );
95- $ b = $ graph ->createVertex (" b " );
97+ $ a = $ graph ->createVertex (' a ' );
98+ $ b = $ graph ->createVertex (' b ' );
9699
97100 $ a ->createEdge ($ b )->setWeight (-12 );
98101
99102 MultiDijkstra::findShortestPaths ($ a , $ b );
100103 }
101104
102- public function testOptimizedExit () {
105+ public function testOptimizedExit ()
106+ {
103107 $ graph = new Graph ();
104108
105- $ a = $ graph ->createVertex (" a " );
106- $ b = $ graph ->createVertex (" b " );
107- $ c = $ graph ->createVertex (" c " );
108- $ d = $ graph ->createVertex (" d " );
109- $ e = $ graph ->createVertex (" e " );
110- $ f = $ graph ->createVertex (" f " );
111- $ g = $ graph ->createVertex (" g " );
112- $ h = $ graph ->createVertex (" h " );
113- $ i = $ graph ->createVertex (" i " );
114- $ j = $ graph ->createVertex (" j " );
109+ $ a = $ graph ->createVertex (' a ' );
110+ $ b = $ graph ->createVertex (' b ' );
111+ $ c = $ graph ->createVertex (' c ' );
112+ $ d = $ graph ->createVertex (' d ' );
113+ $ e = $ graph ->createVertex (' e ' );
114+ $ f = $ graph ->createVertex (' f ' );
115+ $ g = $ graph ->createVertex (' g ' );
116+ $ h = $ graph ->createVertex (' h ' );
117+ $ i = $ graph ->createVertex (' i ' );
118+ $ j = $ graph ->createVertex (' j ' );
115119
116120 $ a ->createEdge ($ b )->setWeight (1 );
117121 $ a ->createEdge ($ c )->setWeight (217 );
@@ -134,17 +138,19 @@ public function testOptimizedExit() {
134138 $ this ->assertTrue ($ this ->hasVertex ($ edges [0 ], $ b ));
135139 }
136140
137- private function hasVertex (Edge \Base $ edge , Vertex $ vertex ) {
141+ private function hasVertex (Edge \Base $ edge , Vertex $ vertex )
142+ {
138143 return $ edge ->getVerticesStart ()->getVertexFirst () === $ vertex || $ edge ->getVerticesTarget ()->getVertexFirst () === $ vertex ;
139144 }
140145
141- public function testDijkstraAmbiguity2 () {
146+ public function testDijkstraAmbiguity2 ()
147+ {
142148 $ graph = new Graph ();
143149
144- $ a = $ graph ->createVertex (" a " );
145- $ b = $ graph ->createVertex (" b " );
146- $ c = $ graph ->createVertex (" c " );
147- $ d = $ graph ->createVertex (" d " );
150+ $ a = $ graph ->createVertex (' a ' );
151+ $ b = $ graph ->createVertex (' b ' );
152+ $ c = $ graph ->createVertex (' c ' );
153+ $ d = $ graph ->createVertex (' d ' );
148154
149155 $ a ->createEdge ($ b )->setWeight (12 );
150156 $ a ->createEdge ($ c )->setWeight (42 );
@@ -170,14 +176,15 @@ public function testDijkstraAmbiguity2() {
170176 $ this ->assertTrue ($ this ->hasVertex ($ paths [1 ][1 ], $ d ));
171177 }
172178
173- public function testDijkstraAmbiguity3 () {
179+ public function testDijkstraAmbiguity3 ()
180+ {
174181 $ graph = new Graph ();
175182
176- $ a = $ graph ->createVertex (" a " );
177- $ b = $ graph ->createVertex (" b " );
178- $ c = $ graph ->createVertex (" c " );
179- $ d = $ graph ->createVertex (" d " );
180- $ e = $ graph ->createVertex (" e " );
183+ $ a = $ graph ->createVertex (' a ' );
184+ $ b = $ graph ->createVertex (' b ' );
185+ $ c = $ graph ->createVertex (' c ' );
186+ $ d = $ graph ->createVertex (' d ' );
187+ $ e = $ graph ->createVertex (' e ' );
181188
182189 $ a ->createEdge ($ b )->setWeight (12 );
183190 $ a ->createEdge ($ c )->setWeight (42 );
@@ -192,5 +199,4 @@ public function testDijkstraAmbiguity3() {
192199
193200 $ this ->assertCount (4 , $ paths );
194201 }
195-
196202}
0 commit comments