Skip to content
This repository was archived by the owner on Sep 27, 2021. It is now read-only.

Commit ad00cd2

Browse files
committed
Fix Graphwalker suite execution (infinite loop)
1 parent 78cf052 commit ad00cd2

File tree

10 files changed

+352
-17
lines changed

10 files changed

+352
-17
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ before_script:
1010
- composer install --prefer-source --no-interaction
1111

1212
script:
13-
- php ./vendor/bin/codecept run unit --coverage-xml
13+
- php ./vendor/bin/codecept run unit,acceptance --coverage-xml
1414

1515
after_success:
1616
- travis_retry php ./vendor/bin/php-coveralls

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ $ composer require edno/codeception-graphwalker
2727
Add the **GraphWalker** format to the list of supported format into your suite configuration file (`.suite.yml`):
2828
```yaml
2929
formats:
30-
- \edno\codeception-graphwalker\GraphWalker
30+
- edno\codeception-graphwalker\GraphWalker
3131
```
3232
33-
In the configuration file, declare the graph algorithm class to be used:
33+
In the configuration file, declare the graph **algorithm** class to be used and the scripts **path** :
3434
```yaml
3535
graphwalker:
3636
algorithm: Graphp\Algorithms\ShortestPath\Dijkstra
37+
path: tests_/data/
3738
```
3839
*Refer to [graphp/algorithms](https://github.com/graphp/algorithms) for supported algorithms.*
3940

src/GraphWalker.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ class GraphWalker implements LoaderInterface
1414

1515
protected static $defaultSettings = [
1616
'graphwalker' => [
17-
'algorithm' => ''
17+
'algorithm' => '',
18+
'path' => ''
1819
],
19-
'path' => ''
2020
];
2121

2222
protected $settings = [];
@@ -38,15 +38,18 @@ class GraphWalker implements LoaderInterface
3838
public function __construct($settings = [])
3939
{
4040
$this->settings = Configuration::mergeConfigs(self::$defaultSettings, $settings);
41+
4142
$this->algorithmClass = $this->settings['graphwalker']['algorithm'];
4243
if($this->algorithmClass == '' ) {
4344
throw new ModuleConfigException(__CLASS__, 'Configuration setting "algorithm" is missing');
4445
}
46+
47+
$this->path = $this->settings['graphwalker']['path'];
4548

4649
$this->di = new Di();
4750

4851
$this->parser = new GraphLoader();
49-
$this->loader = new TestLoader($this->settings);
52+
$this->loader = new \Codeception\Test\Loader(['path' => $this->path]);
5053
}
5154

5255
public function loadTests($filename)
@@ -64,6 +67,7 @@ public function loadTests($filename)
6467
$file = $this->path . $step->getAttribute('labels')[0];
6568
$this->loader->loadTest($file);
6669
}
70+
$this->settings['exclude'][] = $filename;
6771
$this->tests = $this->loader->getTests();
6872
}
6973

tests/_support/MbtTester.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
class MbtTester extends \Codeception\Actor
4+
{
5+
use _generated\MbtTesterActions;
6+
7+
/**
8+
* Define custom actions here
9+
*/
10+
}

tests/acceptance.suite.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@
77
actor: AcceptanceTester
88
modules:
99
enabled:
10-
- PhpBrowser:
11-
url: http://localhost/myapp
12-
- \Helper\Acceptance
10+
- Cli
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
class BasicGraphCest
3+
{
4+
public function runBasicGraphTest(AcceptanceTester $I)
5+
{
6+
$I->runShellCommand('vendor/bin/codecept run mbt');
7+
$I->seeResultCodeIs(0);
8+
$I->seeInShellOutput('OK (4 tests, 4 assertions)');
9+
}
10+
}
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<!--Created by yFiles for HTML 2.2-EAP11-->
3+
<graphml xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml.html/2.0/ygraphml.xsd " xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:demostyle="http://www.yworks.com/yFilesHTML/demos/FlatDemoStyle/1.0" xmlns:bpmn="http://www.yworks.com/xml/yfiles-for-html/bpmn/2.0" xmlns:demotablestyle="http://www.yworks.com/yFilesHTML/demos/FlatDemoTableStyle/1.0" xmlns:uml="http://www.yworks.com/yFilesHTML/demos/UMLDemoStyle/1.0" xmlns:compat="http://www.yworks.com/xml/yfiles-compat-arrows/1.0" xmlns:GraphvizNodeStyle="http://www.yworks.com/yFilesHTML/graphviz-node-style/1.0" xmlns:VuejsNodeStyle="http://www.yworks.com/demos/yfiles-vuejs-node-style/1.0" xmlns:y="http://www.yworks.com/xml/yfiles-common/3.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/3.0" xmlns:yjs="http://www.yworks.com/xml/yfiles-for-html/2.0/xaml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<key id="d0" for="node" attr.type="boolean" attr.name="Expanded" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/folding/Expanded">
5+
<default>true</default>
6+
</key>
7+
<key id="d1" for="node" attr.type="string" attr.name="url"/>
8+
<key id="d2" for="node" attr.type="string" attr.name="description"/>
9+
<key id="d3" for="node" attr.name="NodeLabels" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/NodeLabels"/>
10+
<key id="d4" for="node" attr.name="NodeGeometry" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/NodeGeometry"/>
11+
<key id="d5" for="all" attr.name="UserTags" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/UserTags"/>
12+
<key id="d6" for="node" attr.name="NodeStyle" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/NodeStyle"/>
13+
<key id="d7" for="node" attr.name="NodeViewState" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/folding/1.1/NodeViewState"/>
14+
<key id="d8" for="edge" attr.type="string" attr.name="url"/>
15+
<key id="d9" for="edge" attr.type="string" attr.name="description"/>
16+
<key id="d10" for="edge" attr.name="EdgeLabels" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/EdgeLabels"/>
17+
<key id="d11" for="edge" attr.name="EdgeGeometry" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/EdgeGeometry"/>
18+
<key id="d12" for="edge" attr.name="EdgeStyle" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/EdgeStyle"/>
19+
<key id="d13" for="edge" attr.name="EdgeViewState" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/folding/1.1/EdgeViewState"/>
20+
<key id="d14" for="port" attr.name="PortLabels" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/PortLabels"/>
21+
<key id="d15" for="port" attr.name="PortLocationParameter" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/PortLocationParameter">
22+
<default>
23+
<x:Static Member="y:FreeNodePortLocationModel.NodeCenterAnchored"/>
24+
</default>
25+
</key>
26+
<key id="d16" for="port" attr.name="PortStyle" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/PortStyle">
27+
<default>
28+
<x:Static Member="y:VoidPortStyle.Instance"/>
29+
</default>
30+
</key>
31+
<key id="d17" for="port" attr.name="PortViewState" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/folding/1.1/PortViewState"/>
32+
<key id="d18" attr.name="SharedData" y:attr.uri="http://www.yworks.com/xml/yfiles-common/2.0/SharedData"/>
33+
<data key="d18">
34+
<y:SharedData>
35+
<yjs:DefaultLabelStyle x:Key="1" textFill="BLACK">
36+
<yjs:DefaultLabelStyle.font>
37+
<yjs:Font fontSize="12" fontFamily="'Arial'"/>
38+
</yjs:DefaultLabelStyle.font>
39+
</yjs:DefaultLabelStyle>
40+
<yjs:Stroke x:Key="2" fill="{y:GraphMLReference 3}"/>
41+
<yjs:SolidColorFill x:Key="3" color="DarkOrange"/>
42+
<yjs:Stroke x:Key="4" fill="#FF336699"/>
43+
<yjs:PolylineEdgeStyle x:Key="5" stroke="{y:GraphMLReference 4}">
44+
<yjs:PolylineEdgeStyle.targetArrow>
45+
<yjs:Arrow type="TRIANGLE" scale="0.75" stroke="{y:GraphMLReference 4}" fill="#FF336699" cropLength="1"/>
46+
</yjs:PolylineEdgeStyle.targetArrow>
47+
</yjs:PolylineEdgeStyle>
48+
</y:SharedData>
49+
</data>
50+
<graph id="G" edgedefault="directed">
51+
<node id="n0">
52+
<data key="d2"><![CDATA[]]></data>
53+
<data key="d3">
54+
<x:List>
55+
<y:Label LayoutParameter="{x:Static y:InteriorLabelModel.Center}" Style="{y:GraphMLReference 1}">
56+
<y:Label.Text>unit/firstTest.php</y:Label.Text>
57+
</y:Label>
58+
</x:List>
59+
</data>
60+
<data key="d4">
61+
<y:RectD X="-144.5" Y="-285" Width="311" Height="50"/>
62+
</data>
63+
<data key="d6">
64+
<yjs:ShapeNodeStyle stroke="{y:GraphMLReference 2}" fill="{y:GraphMLReference 3}"/>
65+
</data>
66+
<port name="p0"/>
67+
</node>
68+
<node id="n1">
69+
<data key="d3">
70+
<x:List>
71+
<y:Label LayoutParameter="{x:Static y:InteriorLabelModel.Center}" Style="{y:GraphMLReference 1}">
72+
<y:Label.Text>unit/secondTest.php</y:Label.Text>
73+
</y:Label>
74+
</x:List>
75+
</data>
76+
<data key="d4">
77+
<y:RectD X="-144.5" Y="-160" Width="311" Height="50"/>
78+
</data>
79+
<data key="d6">
80+
<yjs:ShapeNodeStyle stroke="{y:GraphMLReference 2}" fill="{y:GraphMLReference 3}"/>
81+
</data>
82+
<port name="p0"/>
83+
<port name="p1"/>
84+
<port name="p2">
85+
<data key="d15">
86+
<y:FreeNodePortLocationModelParameter Ratio="0.9968051118210863,0.5"/>
87+
</data>
88+
</port>
89+
</node>
90+
<node id="n2">
91+
<data key="d3">
92+
<x:List>
93+
<y:Label LayoutParameter="{x:Static y:InteriorLabelModel.Center}" Style="{y:GraphMLReference 1}">
94+
<y:Label.Text>unit/thirdTest.php</y:Label.Text>
95+
</y:Label>
96+
</x:List>
97+
</data>
98+
<data key="d4">
99+
<y:RectD X="-144.5" Y="-49" Width="311" Height="50"/>
100+
</data>
101+
<data key="d6">
102+
<yjs:ShapeNodeStyle stroke="{y:GraphMLReference 2}" fill="{y:GraphMLReference 3}"/>
103+
</data>
104+
<port name="p0"/>
105+
<port name="p1">
106+
<data key="d15">
107+
<y:FreeNodePortLocationModelParameter Ratio="0.9968051118210863,0.5"/>
108+
</data>
109+
</port>
110+
</node>
111+
<node id="n3">
112+
<data key="d3">
113+
<x:List>
114+
<y:Label LayoutParameter="{x:Static y:InteriorLabelModel.Center}" Style="{y:GraphMLReference 1}">
115+
<y:Label.Text>unit/fourthTest.php</y:Label.Text>
116+
</y:Label>
117+
</x:List>
118+
</data>
119+
<data key="d4">
120+
<y:RectD X="241" Y="-49" Width="311" Height="50"/>
121+
</data>
122+
<data key="d6">
123+
<yjs:ShapeNodeStyle stroke="{y:GraphMLReference 2}" fill="{y:GraphMLReference 3}"/>
124+
</data>
125+
<port name="p0"/>
126+
<port name="p1">
127+
<data key="d15">
128+
<y:FreeNodePortLocationModelParameter Ratio="0.5,0.019230769230769218"/>
129+
</data>
130+
</port>
131+
</node>
132+
<edge id="e0" source="n0" target="n1" sourceport="p0" targetport="p0">
133+
<data key="d12">
134+
<y:GraphMLReference ResourceKey="5"/>
135+
</data>
136+
</edge>
137+
<edge id="e1" source="n1" target="n2" sourceport="p1" targetport="p0">
138+
<data key="d12">
139+
<y:GraphMLReference ResourceKey="5"/>
140+
</data>
141+
</edge>
142+
<edge id="e2" source="n2" target="n3" sourceport="p1" targetport="p0">
143+
<data key="d12">
144+
<y:GraphMLReference ResourceKey="5"/>
145+
</data>
146+
</edge>
147+
<edge id="e3" source="n1" target="n3" sourceport="p2" targetport="p1">
148+
<data key="d12">
149+
<y:GraphMLReference ResourceKey="5"/>
150+
</data>
151+
</edge>
152+
</graph>
153+
</graphml>

tests/mbt.suite.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
actor: MbtTester
2+
formats:
3+
- edno\Codeception\GraphWalker
4+
graphwalker:
5+
algorithm: Graphp\Algorithms\ShortestPath\Dijkstra
6+
path: tests/_data/

0 commit comments

Comments
 (0)