@@ -58,156 +58,41 @@ class PHP_CodeCoverage_Report_NodeTest extends PHPUnit_Framework_TestCase
5858{
5959 public function testTrimsTailingSlashes ()
6060 {
61- $ node = new DefaultNode ('/SomeName.php/ ' );
61+ $ node = $ this -> getInstance ('/SomeName.php/ ' );
6262 $ this ->assertEquals ('/SomeName.php ' , $ node ->getPath ());
6363 }
6464
6565 public function testNodeAcceptsRootScope ()
6666 {
67- $ node = new DefaultNode ('/ ' );
67+ $ node = $ this -> getInstance ('/ ' );
6868 $ this ->assertEquals ('/ ' , $ node ->getPath ());
6969 }
70- }
71-
72- class DefaultNode extends PHP_CodeCoverage_Report_Node
73- {
74-
75- /**
76- * Returns the classes of this node.
77- *
78- * @return array
79- */
80- public function getClasses ()
81- {
82- }
83-
84- /**
85- * Returns the traits of this node.
86- *
87- * @return array
88- */
89- public function getTraits ()
90- {
91- }
92-
93- /**
94- * Returns the functions of this node.
95- *
96- * @return array
97- */
98- public function getFunctions ()
99- {
100- }
101-
102- /**
103- * Returns the LOC/CLOC/NCLOC of this node.
104- *
105- * @return array
106- */
107- public function getLinesOfCode ()
108- {
109- }
110-
111- /**
112- * Returns the number of executable lines.
113- *
114- * @return integer
115- */
116- public function getNumExecutableLines ()
117- {
118- }
119-
120- /**
121- * Returns the number of executed lines.
122- *
123- * @return integer
124- */
125- public function getNumExecutedLines ()
126- {
127- }
128-
129- /**
130- * Returns the number of classes.
131- *
132- * @return integer
133- */
134- public function getNumClasses ()
135- {
136- }
137-
138- /**
139- * Returns the number of tested classes.
140- *
141- * @return integer
142- */
143- public function getNumTestedClasses ()
144- {
145- }
146-
147- /**
148- * Returns the number of traits.
149- *
150- * @return integer
151- */
152- public function getNumTraits ()
153- {
154- }
155-
156- /**
157- * Returns the number of tested traits.
158- *
159- * @return integer
160- */
161- public function getNumTestedTraits ()
162- {
163- }
16470
16571 /**
166- * Returns the number of methods.
167- *
168- * @return integer
72+ * @param $path
73+ * @return PHP_CodeCoverage_Report_Node
16974 */
170- public function getNumMethods ( )
75+ private function getInstance ( $ path )
17176 {
172- }
77+ $ builder = $ this ->getMockBuilder ('PHP_CodeCoverage_Report_Node ' )
78+ ->setConstructorArgs (array ($ path ));
17379
174- /**
175- * Returns the number of tested methods.
176- *
177- * @return integer
178- */
179- public function getNumTestedMethods ()
180- {
80+ $ this ->mockMethods ($ builder );
81+ return $ builder ->getMock ();
18182 }
18283
18384 /**
184- * Returns the number of functions.
185- *
186- * @return integer
85+ * @param $builder
18786 */
188- public function getNumFunctions ( )
87+ private function mockMethods ( $ builder )
18988 {
89+ $ reflectionClass = new \ReflectionClass ('PHP_CodeCoverage_Report_Node ' );
90+ $ methods = array ();
91+ foreach ($ reflectionClass ->getMethods () as $ method ) {
92+ if ($ method ->isAbstract ()) {
93+ $ methods [] = $ method ->getName ();
94+ }
95+ }
96+ $ builder ->setMethods ($ methods );
19097 }
191-
192- /**
193- * Returns the number of tested functions.
194- *
195- * @return integer
196- */
197- public function getNumTestedFunctions ()
198- {
199- }
200-
201- /**
202- * (PHP 5 >= 5.1.0)<br/>
203- * Count elements of an object
204- * @link http://php.net/manual/en/countable.count.php
205- * @return int The custom count as an integer.
206- * </p>
207- * <p>
208- * The return value is cast to an integer.
209- */
210- public function count ()
211- {
212- }
213- }
98+ }
0 commit comments