File tree Expand file tree Collapse file tree 2 files changed +31
-28
lines changed Expand file tree Collapse file tree 2 files changed +31
-28
lines changed Original file line number Diff line number Diff line change @@ -106,27 +106,6 @@ public function testConstructor2()
106106 */
107107 public function testCollect ()
108108 {
109- $ coverage = new PHP_CodeCoverage ($ this ->setUpXdebugStub ());
110-
111- $ coverage ->start (
112- new BankAccountTest ('testBalanceIsInitiallyZero ' ), TRUE
113- );
114- $ coverage ->stop ();
115-
116- $ coverage ->start (new BankAccountTest (
117- 'testBalanceCannotBecomeNegative ' )
118- );
119- $ coverage ->stop ();
120-
121- $ coverage ->start (
122- new BankAccountTest ('testBalanceCannotBecomeNegative2 ' )
123- );
124- $ coverage ->stop ();
125-
126- $ coverage ->start (
127- new BankAccountTest ('testDepositWithdrawMoney ' )
128- );
129- $ coverage ->stop ();
130109
131110 $ this ->assertAttributeEquals (
132111 array (
@@ -191,17 +170,14 @@ public function testCollect()
191170 )
192171 ),
193172 'data ' ,
194- $ coverage
173+ $ this -> getBankAccountCoverage ()
195174 );
196-
197- return $ coverage ;
198175 }
199176
200177 /**
201- * @covers PHP_CodeCoverage::getSummary
202- * @depends testCollect
178+ * @covers PHP_CodeCoverage::getSummary
203179 */
204- public function testSummary (PHP_CodeCoverage $ coverage )
180+ public function testSummary ()
205181 {
206182 $ this ->assertEquals (
207183 array (
@@ -234,7 +210,7 @@ public function testSummary(PHP_CodeCoverage $coverage)
234210 32 => -2
235211 )
236212 ),
237- $ coverage ->getSummary ()
213+ $ this -> getBankAccountCoverage () ->getSummary ()
238214 );
239215 }
240216}
Original file line number Diff line number Diff line change 5959 */
6060abstract class PHP_CodeCoverage_TestCase extends PHPUnit_Framework_TestCase
6161{
62+ protected function getBankAccountCoverage ()
63+ {
64+ $ coverage = new PHP_CodeCoverage ($ this ->setUpXdebugStub ());
65+
66+ $ coverage ->start (
67+ new BankAccountTest ('testBalanceIsInitiallyZero ' ), TRUE
68+ );
69+ $ coverage ->stop ();
70+
71+ $ coverage ->start (new BankAccountTest (
72+ 'testBalanceCannotBecomeNegative ' )
73+ );
74+ $ coverage ->stop ();
75+
76+ $ coverage ->start (
77+ new BankAccountTest ('testBalanceCannotBecomeNegative2 ' )
78+ );
79+ $ coverage ->stop ();
80+
81+ $ coverage ->start (
82+ new BankAccountTest ('testDepositWithdrawMoney ' )
83+ );
84+ $ coverage ->stop ();
85+
86+ return $ coverage ;
87+ }
88+
6289 protected function setUpXdebugStub ()
6390 {
6491 $ stub = $ this ->getMock ('PHP_CodeCoverage_Driver_Xdebug ' );
You can’t perform that action at this time.
0 commit comments