@@ -13,7 +13,12 @@ protected function _before()
1313 public function testGetTestsFromModel ()
1414 {
1515 $ model = codecept_data_dir ().'basicgraph.graphml ' ;
16- $ graphwalker = new GraphWalker (['path ' => 'tests/_data/ ' ]);
16+ $ graphwalker = new GraphWalker ([
17+ 'path ' => 'tests/_data/ ' ,
18+ 'graphwalker ' => [
19+ 'algorithm ' => 'Graphp\Algorithms\ShortestPath\Dijkstra '
20+ ]
21+ ]);
1722 $ graphwalker ->loadTests ($ model );
1823 $ this ->assertInstanceOf ('\Fhaculty\Graph\Graph ' ,$ graphwalker ->getGraph ());
1924 $ tests = $ graphwalker ->getTests ();
@@ -26,4 +31,63 @@ public function testGetTestsFromModel()
2631 }
2732
2833
34+ /**
35+ * @expectedException Codeception\Exception\ModuleConfigException
36+ */
37+ public function testExceptionAlgorithmSettingMissing ()
38+ {
39+ $ graphwalker = new GraphWalker ();
40+ }
41+
42+ /**
43+ * @expectedException Codeception\Exception\TestParseException
44+ */
45+ public function testExceptionAlgorithmSettingInvalid ()
46+ {
47+ $ model = codecept_data_dir ().'basicgraph.graphml ' ;
48+ $ graphwalker = new GraphWalker ([
49+ 'path ' => 'tests/_data/ ' ,
50+ 'graphwalker ' => [
51+ 'algorithm ' => 'Graphp\Algorithms\DoesNotExist '
52+ ]
53+ ]);
54+ $ graphwalker ->loadTests ($ model );
55+ $ this ->assertInstanceOf ('\Fhaculty\Graph\Graph ' ,$ graphwalker ->getGraph ());
56+ $ tests = $ graphwalker ->getTests ();
57+ }
58+
59+ /**
60+ * @expectedException Codeception\Exception\TestParseException
61+ */
62+ public function testExceptionTestFileNotExist ()
63+ {
64+ $ model = codecept_data_dir ().'doesnotexist.graphml ' ;
65+ $ graphwalker = new GraphWalker ([
66+ 'path ' => 'tests/_data/ ' ,
67+ 'graphwalker ' => [
68+ 'algorithm ' => 'Graphp\Algorithms\ShortestPath\Dijkstra '
69+ ]
70+ ]);
71+ $ graphwalker ->loadTests ($ model );
72+ $ this ->assertInstanceOf ('\Fhaculty\Graph\Graph ' ,$ graphwalker ->getGraph ());
73+ $ tests = $ graphwalker ->getTests ();
74+ }
75+
76+ /**
77+ * @expectedException Codeception\Exception\TestParseException
78+ */
79+ public function testExceptionTestFileInvalid ()
80+ {
81+ $ model = codecept_data_dir ().'notagrapfile.graphml ' ;
82+ $ graphwalker = new GraphWalker ([
83+ 'path ' => 'tests/_data/ ' ,
84+ 'graphwalker ' => [
85+ 'algorithm ' => 'Graphp\Algorithms\ShortestPath\Dijkstra '
86+ ]
87+ ]);
88+ $ graphwalker ->loadTests ($ model );
89+ $ this ->assertInstanceOf ('\Fhaculty\Graph\Graph ' ,$ graphwalker ->getGraph ());
90+ $ tests = $ graphwalker ->getTests ();
91+ }
92+
2993}
0 commit comments