@@ -195,76 +195,51 @@ public function testBuildDirectoryStructure()
195195 }
196196
197197 /**
198- * @covers PHP_CodeCoverage_Report_Factory::reducePaths
198+ * @covers PHP_CodeCoverage_Report_Factory::reducePaths
199+ * @dataProvider reducePathsProvider
199200 */
200- public function testReducePaths ()
201+ public function testReducePaths ($ reducedPaths , $ commonPath , $ paths )
201202 {
202203 $ method = new ReflectionMethod (
203204 'PHP_CodeCoverage_Report_Factory ' , 'reducePaths '
204205 );
205206
206207 $ method ->setAccessible (TRUE );
207208
208- $ files = array (
209- '/home/sb/Money/Money.php ' => array (),
210- '/home/sb/Money/MoneyBag.php ' => array ()
211- );
212-
213- $ commonPath = $ method ->invokeArgs ($ this ->factory , array (&$ files ));
214-
215- $ this ->assertEquals (
216- array (
217- 'Money.php ' => array (),
218- 'MoneyBag.php ' => array ()
219- ),
220- $ files
221- );
209+ $ _commonPath = $ method ->invokeArgs ($ this ->factory , array (&$ paths ));
222210
223- $ this ->assertEquals ('/home/sb/Money ' , $ commonPath );
211+ $ this ->assertEquals ($ reducedPaths , $ paths );
212+ $ this ->assertEquals ($ commonPath , $ _commonPath );
224213 }
225214
226- /**
227- * @covers PHP_CodeCoverage_Report_Factory::reducePaths
228- */
229- public function testReducePaths2 ()
215+ public function reducePathsProvider ()
230216 {
231- $ method = new ReflectionMethod (
232- 'PHP_CodeCoverage_Report_Factory ' , 'reducePaths '
233- );
234-
235- $ method ->setAccessible (TRUE );
236-
237- $ files = array ();
238-
239- $ commonPath = $ method ->invokeArgs ($ this ->factory , array (&$ files ));
240-
241- $ this ->assertEquals ('. ' , $ commonPath );
242- }
243-
244- /**
245- * @covers PHP_CodeCoverage_Report_Factory::reducePaths
246- */
247- public function testReducePaths3 ()
248- {
249- $ method = new ReflectionMethod (
250- 'PHP_CodeCoverage_Report_Factory ' , 'reducePaths '
251- );
252-
253- $ method ->setAccessible (TRUE );
254-
255- $ files = array (
256- '/home/sb/Money/Money.php ' => array ()
257- );
258-
259- $ commonPath = $ method ->invokeArgs ($ this ->factory , array (&$ files ));
260-
261- $ this ->assertEquals (
217+ return array (
262218 array (
263- 'Money.php ' => array ()
219+ array (
220+ 'Money.php ' => array (),
221+ 'MoneyBag.php ' => array ()
222+ ),
223+ '/home/sb/Money ' ,
224+ array (
225+ '/home/sb/Money/Money.php ' => array (),
226+ '/home/sb/Money/MoneyBag.php ' => array ()
227+ )
264228 ),
265- $ files
229+ array (
230+ array (
231+ 'Money.php ' => array ()
232+ ),
233+ '/home/sb/Money/ ' ,
234+ array (
235+ '/home/sb/Money/Money.php ' => array ()
236+ )
237+ ),
238+ array (
239+ array (),
240+ '. ' ,
241+ array ()
242+ )
266243 );
267-
268- $ this ->assertEquals ('/home/sb/Money/ ' , $ commonPath );
269244 }
270245}
0 commit comments