1 | <?php |
||
29 | class NodeTest extends TestCase |
||
30 | { |
||
31 | /** @var Node */ |
||
32 | protected $fixture = null; |
||
33 | |||
34 | /** |
||
35 | * Initializes the fixture for this test. |
||
36 | */ |
||
37 | protected function setUp() |
||
41 | |||
42 | /** |
||
43 | * Tests the construct method |
||
44 | * |
||
45 | * @covers \phpDocumentor\GraphViz\Node::__construct |
||
46 | * |
||
47 | * @returnn void |
||
48 | */ |
||
49 | public function testConstruct() |
||
59 | |||
60 | /** |
||
61 | * Tests the create method |
||
62 | * |
||
63 | * @covers \phpDocumentor\GraphViz\Node::create |
||
64 | * |
||
65 | * @returnn void |
||
66 | */ |
||
67 | public function testCreate() |
||
74 | |||
75 | /** |
||
76 | * Tests the getting and setting of the name. |
||
77 | * |
||
78 | * @covers \phpDocumentor\GraphViz\Node::getName |
||
79 | * @covers \phpDocumentor\GraphViz\Node::setName |
||
80 | */ |
||
81 | public function testName() |
||
99 | |||
100 | /** |
||
101 | * Tests the magic __call method, to work as described, return the object |
||
102 | * instance for a setX method, return the value for an getX method, and null |
||
103 | * for the remaining method calls |
||
104 | * |
||
105 | * @covers \phpDocumentor\GraphViz\Node::__call |
||
106 | * @covers \phpDocumentor\GraphViz\Node::getAttribute |
||
107 | * @covers \phpDocumentor\GraphViz\Node::setAttribute |
||
108 | */ |
||
109 | public function testCall() |
||
116 | |||
117 | /** |
||
118 | * @covers \phpDocumentor\GraphViz\Node::getAttribute |
||
119 | */ |
||
120 | public function testGetNonExistingAttributeThrowsAttributeNotFound() |
||
127 | |||
128 | /** |
||
129 | * Tests whether the magic __toString method returns a well formatted string |
||
130 | * as specified in the DOT standard |
||
131 | * |
||
132 | * @covers \phpDocumentor\GraphViz\Node::__toString |
||
133 | */ |
||
134 | public function testToString() |
||
149 | |||
150 | /** |
||
151 | * Tests whether the magic __toString method returns a well formatted string |
||
152 | * as specified in the DOT standard when the label contains slashes. |
||
153 | * |
||
154 | * @covers \phpDocumentor\GraphViz\Node::__toString |
||
155 | */ |
||
156 | public function testToStringWithLabelContainingSlashes() |
||
172 | } |
||
173 |
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: