File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -289,7 +289,7 @@ private function getNextId()
289289 }
290290
291291 // auto ID
292- return max (array_keys ($ this ->verticesStorage ))+1 ;
292+ return max (array_map ( ' intval ' , array_keys ($ this ->verticesStorage ) ))+1 ;
293293 }
294294
295295 /**
Original file line number Diff line number Diff line change 99
1010class GraphTest extends AbstractAttributeAwareTest
1111{
12+ /** @var Graph */
13+ private $ graph ;
14+
1215 /**
1316 * @before
1417 */
@@ -17,6 +20,17 @@ public function setUpGraph()
1720 $ this ->graph = new Graph ();
1821 }
1922
23+ public function testMixedIds ()
24+ {
25+ $ vertexString = $ this ->graph ->createVertex ('test ' );
26+ $ vertex1 = $ this ->graph ->createVertex ();
27+ $ vertex2 = $ this ->graph ->createVertex ();
28+
29+ self ::assertEquals ('test ' , $ vertexString ->getId ());
30+ self ::assertEquals (1 , $ vertex1 ->getId ());
31+ self ::assertEquals (2 , $ vertex2 ->getId ());
32+ }
33+
2034 public function testVertexClone ()
2135 {
2236 $ graph = new Graph ();
You can’t perform that action at this time.
0 commit comments