1 | <?php |
||
31 | class EdgeTest extends TestCase |
||
32 | { |
||
33 | /** |
||
34 | * Tears down the fixture, for example, closes a network connection. |
||
35 | * This method is called after a test is executed. |
||
36 | */ |
||
37 | protected function tearDown() |
||
41 | |||
42 | /** |
||
43 | * Tests the construct method |
||
44 | * |
||
45 | * @covers \phpDocumentor\GraphViz\Edge::__construct |
||
46 | */ |
||
47 | public function testConstruct() |
||
66 | |||
67 | /** |
||
68 | * Tests the create method |
||
69 | * |
||
70 | * @covers \phpDocumentor\GraphViz\Edge::create |
||
71 | */ |
||
72 | public function testCreate() |
||
79 | |||
80 | /** |
||
81 | * Tests whether the getFrom method returns the same node as passed |
||
82 | * in the create method |
||
83 | * |
||
84 | * @covers \phpDocumentor\GraphViz\Edge::getFrom |
||
85 | */ |
||
86 | public function testGetFrom() |
||
92 | |||
93 | /** |
||
94 | * Tests the getTo method returns the same node as passed |
||
95 | * in the create method |
||
96 | * |
||
97 | * @covers \phpDocumentor\GraphViz\Edge::getTo |
||
98 | */ |
||
99 | public function testGetTo() |
||
105 | |||
106 | /** |
||
107 | * Tests the magic __call method, to work as described, return the object |
||
108 | * instance for a setX method, return the value for an getX method, and null |
||
109 | * for the remaining method calls |
||
110 | * |
||
111 | * @covers \phpDocumentor\GraphViz\Edge::__call |
||
112 | * @covers \phpDocumentor\GraphViz\Edge::setAttribute |
||
113 | * @covers \phpDocumentor\GraphViz\Edge::getAttribute |
||
114 | */ |
||
115 | public function testCall() |
||
123 | |||
124 | /** |
||
125 | * @covers \phpDocumentor\GraphViz\Edge::getAttribute |
||
126 | */ |
||
127 | public function testGetNonExistingAttributeThrowsAttributeNotFound() |
||
136 | |||
137 | /** |
||
138 | * Tests whether the magic __toString method returns a well formatted string |
||
139 | * as specified in the DOT standard |
||
140 | * |
||
141 | * @covers \phpDocumentor\GraphViz\Edge::__toString |
||
142 | */ |
||
143 | public function testToString() |
||
158 | } |
||
159 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: