1 | <?php |
||
18 | class GraphFormatterTest extends \PHPUnit_Framework_TestCase { |
||
19 | |||
20 | /* |
||
21 | * @see https://www.semantic-mediawiki.org/wiki/Help:Graph_format |
||
22 | */ |
||
23 | private $options; |
||
24 | |||
25 | private $graphFormatter; |
||
26 | |||
27 | private $nodes = []; |
||
28 | |||
29 | protected function setUp() { |
||
30 | parent::setUp(); |
||
31 | |||
32 | $params = [ |
||
33 | 'graphname' => 'Unit Test', |
||
34 | 'graphsize' => '100', |
||
35 | 'nodeshape' => 'rect', |
||
36 | 'nodelabel' => 'displaytitle', |
||
37 | 'arrowdirection' => 'LR', |
||
38 | 'wordwraplimit' => 20, |
||
39 | 'relation' => 'parent', |
||
40 | 'graphlink' => true, |
||
41 | 'graphlabel' => true, |
||
42 | 'graphcolor' => true, |
||
43 | 'graphlegend' => true, |
||
44 | ]; |
||
45 | |||
46 | $this->options = new GraphOptions($params); |
||
47 | |||
48 | $this->graphFormatter = new GraphFormatter( $this->options ); |
||
49 | |||
50 | $node1 = new GraphNode( 'Team:Alpha' ); |
||
51 | $node1->setLabel( "Alpha" ); |
||
52 | $node1->addParentNode( "Casted", "Person:Alexander Gesinn" ); |
||
53 | $this->nodes[] = $node1; |
||
54 | |||
55 | $node2 = new GraphNode( 'Team:Beta' ); |
||
56 | $node2->setLabel( "Beta" ); |
||
57 | $node2->addParentNode( "Casted", "Person:Sebastian Schmid" ); |
||
58 | $node2->addParentNode( "Casted", "Person:Alexander Gesinn" ); |
||
59 | $node2->addParentNode( "Part of Team ", "Team:Alpha" ); |
||
60 | $this->nodes[] = $node2; |
||
61 | |||
62 | $this->graphFormatter->buildGraph( $this->nodes ); |
||
|
|||
63 | } |
||
64 | |||
65 | public function testCanConstruct() { |
||
66 | $this->assertInstanceOf( GraphFormatter::class, new GraphFormatter( $this->options ) ); |
||
67 | } |
||
68 | |||
69 | public function testGetWordWrappedText() { |
||
75 | |||
76 | public function testGetGraphLegend() { |
||
77 | $expected = "<div class=\"graphlegend\">". |
||
84 | |||
85 | public function testBuildGraph(){ |
||
99 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: