]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/PHPUnit/Tests/TextUI/coverage-source.phpt
Added unit tests.
[Github/sugarcrm.git] / tests / PHPUnit / Tests / TextUI / coverage-source.phpt
1 --TEST--
2 phpunit --coverage-source /tmp BankAccountTest ../../Samples/BankAccount/BankAccountTest.php
3 --FILE--
4 <?php
5 $tempPath = dirname(__FILE__);
6
7 $_SERVER['argv'][1] = '--coverage-source';
8 $_SERVER['argv'][2] = $tempPath;
9 $_SERVER['argv'][3] = 'BankAccountTest';
10 $_SERVER['argv'][4] = '../Samples/BankAccount/BankAccountTest.php';
11
12 define('PHPUnit_MAIN_METHOD', '');
13 require_once dirname(dirname(dirname(__FILE__))) . '/TextUI/Command.php';
14
15 PHPUnit_TextUI_Command::main(FALSE);
16
17 print file_get_contents($tempPath . DIRECTORY_SEPARATOR . 'BankAccount.php.xml');
18 print file_get_contents($tempPath . DIRECTORY_SEPARATOR . 'BankAccountTest.php.xml');
19 ?>
20 --CLEAN--
21 <?php
22 $tempPath = dirname(__FILE__);
23 unlink($tempPath . DIRECTORY_SEPARATOR . 'BankAccount.php.xml');
24 unlink($tempPath . DIRECTORY_SEPARATOR . 'BankAccountTest.php.xml');
25 ?>
26 --EXPECTF--
27 PHPUnit %s by Sebastian Bergmann.
28
29 ...
30
31 Time: 0 seconds
32
33 OK (3 tests, 3 assertions)
34
35 Writing code coverage data to XML files, this may take a moment.
36 <?xml version="1.0" encoding="UTF-8"?>
37 <coveredFile fullPath="%s/BankAccount.php" shortenedPath="BankAccount.php" generated="%i" phpunit="%s">
38   <line lineNumber="1" executed="-3">
39     <body>&lt;?php</body>
40   </line>
41   <line lineNumber="2" executed="-3">
42     <body>/**</body>
43   </line>
44   <line lineNumber="3" executed="-3">
45     <body> * PHPUnit</body>
46   </line>
47   <line lineNumber="4" executed="-3">
48     <body> *</body>
49   </line>
50   <line lineNumber="5" executed="-3">
51     <body> * Copyright (c) 2002-2009, Sebastian Bergmann &lt;sb@sebastian-bergmann.de&gt;.</body>
52   </line>
53   <line lineNumber="6" executed="-3">
54     <body> * All rights reserved.</body>
55   </line>
56   <line lineNumber="7" executed="-3">
57     <body> *</body>
58   </line>
59   <line lineNumber="8" executed="-3">
60     <body> * Redistribution and use in source and binary forms, with or without</body>
61   </line>
62   <line lineNumber="9" executed="-3">
63     <body> * modification, are permitted provided that the following conditions</body>
64   </line>
65   <line lineNumber="10" executed="-3">
66     <body> * are met:</body>
67   </line>
68   <line lineNumber="11" executed="-3">
69     <body> *</body>
70   </line>
71   <line lineNumber="12" executed="-3">
72     <body> *   * Redistributions of source code must retain the above copyright</body>
73   </line>
74   <line lineNumber="13" executed="-3">
75     <body> *     notice, this list of conditions and the following disclaimer.</body>
76   </line>
77   <line lineNumber="14" executed="-3">
78     <body> *</body>
79   </line>
80   <line lineNumber="15" executed="-3">
81     <body> *   * Redistributions in binary form must reproduce the above copyright</body>
82   </line>
83   <line lineNumber="16" executed="-3">
84     <body> *     notice, this list of conditions and the following disclaimer in</body>
85   </line>
86   <line lineNumber="17" executed="-3">
87     <body> *     the documentation and/or other materials provided with the</body>
88   </line>
89   <line lineNumber="18" executed="-3">
90     <body> *     distribution.</body>
91   </line>
92   <line lineNumber="19" executed="-3">
93     <body> *</body>
94   </line>
95   <line lineNumber="20" executed="-3">
96     <body> *   * Neither the name of Sebastian Bergmann nor the names of his</body>
97   </line>
98   <line lineNumber="21" executed="-3">
99     <body> *     contributors may be used to endorse or promote products derived</body>
100   </line>
101   <line lineNumber="22" executed="-3">
102     <body> *     from this software without specific prior written permission.</body>
103   </line>
104   <line lineNumber="23" executed="-3">
105     <body> *</body>
106   </line>
107   <line lineNumber="24" executed="-3">
108     <body> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</body>
109   </line>
110   <line lineNumber="25" executed="-3">
111     <body> * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</body>
112   </line>
113   <line lineNumber="26" executed="-3">
114     <body> * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS</body>
115   </line>
116   <line lineNumber="27" executed="-3">
117     <body> * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE</body>
118   </line>
119   <line lineNumber="28" executed="-3">
120     <body> * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,</body>
121   </line>
122   <line lineNumber="29" executed="-3">
123     <body> * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,</body>
124   </line>
125   <line lineNumber="30" executed="-3">
126     <body> * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</body>
127   </line>
128   <line lineNumber="31" executed="-3">
129     <body> * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</body>
130   </line>
131   <line lineNumber="32" executed="-3">
132     <body> * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</body>
133   </line>
134   <line lineNumber="33" executed="-3">
135     <body> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN</body>
136   </line>
137   <line lineNumber="34" executed="-3">
138     <body> * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE</body>
139   </line>
140   <line lineNumber="35" executed="-3">
141     <body> * POSSIBILITY OF SUCH DAMAGE.</body>
142   </line>
143   <line lineNumber="36" executed="-3">
144     <body> *</body>
145   </line>
146   <line lineNumber="37" executed="-3">
147     <body> * @category   Testing</body>
148   </line>
149   <line lineNumber="38" executed="-3">
150     <body> * @package    PHPUnit</body>
151   </line>
152   <line lineNumber="39" executed="-3">
153     <body> * @author     Sebastian Bergmann &lt;sb@sebastian-bergmann.de&gt;</body>
154   </line>
155   <line lineNumber="40" executed="-3">
156     <body> * @copyright  2002-2009 Sebastian Bergmann &lt;sb@sebastian-bergmann.de&gt;</body>
157   </line>
158   <line lineNumber="41" executed="-3">
159     <body> * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License</body>
160   </line>
161   <line lineNumber="42" executed="-3">
162     <body> * @version    SVN: $%s$</body>
163   </line>
164   <line lineNumber="43" executed="-3">
165     <body> * @link       http://www.phpunit.de/</body>
166   </line>
167   <line lineNumber="44" executed="-3">
168     <body> * @since      File available since Release 2.3.0</body>
169   </line>
170   <line lineNumber="45" executed="-3">
171     <body> */</body>
172   </line>
173   <line lineNumber="46" executed="-3">
174     <body></body>
175   </line>
176   <line lineNumber="47" executed="-3">
177     <body>class BankAccountException extends RuntimeException {}</body>
178   </line>
179   <line lineNumber="48" executed="-3">
180     <body></body>
181   </line>
182   <line lineNumber="49" executed="-3">
183     <body>/**</body>
184   </line>
185   <line lineNumber="50" executed="-3">
186     <body> * A bank account.</body>
187   </line>
188   <line lineNumber="51" executed="-3">
189     <body> *</body>
190   </line>
191   <line lineNumber="52" executed="-3">
192     <body> * @category   Testing</body>
193   </line>
194   <line lineNumber="53" executed="-3">
195     <body> * @package    PHPUnit</body>
196   </line>
197   <line lineNumber="54" executed="-3">
198     <body> * @author     Sebastian Bergmann &lt;sb@sebastian-bergmann.de&gt;</body>
199   </line>
200   <line lineNumber="55" executed="-3">
201     <body> * @copyright  2002-2009 Sebastian Bergmann &lt;sb@sebastian-bergmann.de&gt;</body>
202   </line>
203   <line lineNumber="56" executed="-3">
204     <body> * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License</body>
205   </line>
206   <line lineNumber="57" executed="-3">
207     <body> * @version    Release: %s</body>
208   </line>
209   <line lineNumber="58" executed="-3">
210     <body> * @link       http://www.phpunit.de/</body>
211   </line>
212   <line lineNumber="59" executed="-3">
213     <body> * @since      Class available since Release 2.3.0</body>
214   </line>
215   <line lineNumber="60" executed="-3">
216     <body> */</body>
217   </line>
218   <line lineNumber="61" executed="-3">
219     <body>class BankAccount</body>
220   </line>
221   <line lineNumber="62" executed="-3">
222     <body>{</body>
223   </line>
224   <line lineNumber="63" executed="-3">
225     <body>    /**</body>
226   </line>
227   <line lineNumber="64" executed="-3">
228     <body>     * The bank account's balance.</body>
229   </line>
230   <line lineNumber="65" executed="-3">
231     <body>     *</body>
232   </line>
233   <line lineNumber="66" executed="-3">
234     <body>     * @var    float</body>
235   </line>
236   <line lineNumber="67" executed="-3">
237     <body>     */</body>
238   </line>
239   <line lineNumber="68" executed="-3">
240     <body>    protected $balance = 0;</body>
241   </line>
242   <line lineNumber="69" executed="-3">
243     <body></body>
244   </line>
245   <line lineNumber="70" executed="-3">
246     <body>    /**</body>
247   </line>
248   <line lineNumber="71" executed="-3">
249     <body>     * Returns the bank account's balance.</body>
250   </line>
251   <line lineNumber="72" executed="-3">
252     <body>     *</body>
253   </line>
254   <line lineNumber="73" executed="-3">
255     <body>     * @return float</body>
256   </line>
257   <line lineNumber="74" executed="-3">
258     <body>     */</body>
259   </line>
260   <line lineNumber="75" executed="-3">
261     <body>    public function getBalance()</body>
262   </line>
263   <line lineNumber="76" executed="-3">
264     <body>    {</body>
265   </line>
266   <line lineNumber="77" executed="1">
267     <body>        return $this-&gt;balance;</body>
268     <tests>
269       <test name="testBalanceIsInitiallyZero" status="0" class="BankAccountTest" fullPath="%s/BankAccountTest.php" shortenedPath="/BankAccountTest.php" line="76"/>
270     </tests>
271   </line>
272   <line lineNumber="78" executed="-2">
273     <body>    }</body>
274   </line>
275   <line lineNumber="79" executed="-3">
276     <body></body>
277   </line>
278   <line lineNumber="80" executed="-3">
279     <body>    /**</body>
280   </line>
281   <line lineNumber="81" executed="-3">
282     <body>     * Sets the bank account's balance.</body>
283   </line>
284   <line lineNumber="82" executed="-3">
285     <body>     *</body>
286   </line>
287   <line lineNumber="83" executed="-3">
288     <body>     * @param  float $balance</body>
289   </line>
290   <line lineNumber="84" executed="-3">
291     <body>     * @throws BankAccountException</body>
292   </line>
293   <line lineNumber="85" executed="-3">
294     <body>     */</body>
295   </line>
296   <line lineNumber="86" executed="-3">
297     <body>    protected function setBalance($balance)</body>
298   </line>
299   <line lineNumber="87" executed="-3">
300     <body>    {</body>
301   </line>
302   <line lineNumber="88" executed="-1">
303     <body>        if ($balance &gt;= 0) {</body>
304   </line>
305   <line lineNumber="89" executed="-1">
306     <body>            $this-&gt;balance = $balance;</body>
307   </line>
308   <line lineNumber="90" executed="-1">
309     <body>        } else {</body>
310   </line>
311   <line lineNumber="91" executed="-1">
312     <body>            throw new BankAccountException;</body>
313   </line>
314   <line lineNumber="92" executed="-3">
315     <body>        }</body>
316   </line>
317   <line lineNumber="93" executed="-1">
318     <body>    }</body>
319   </line>
320   <line lineNumber="94" executed="-3">
321     <body></body>
322   </line>
323   <line lineNumber="95" executed="-3">
324     <body>    /**</body>
325   </line>
326   <line lineNumber="96" executed="-3">
327     <body>     * Deposits an amount of money to the bank account.</body>
328   </line>
329   <line lineNumber="97" executed="-3">
330     <body>     *</body>
331   </line>
332   <line lineNumber="98" executed="-3">
333     <body>     * @param  float $balance</body>
334   </line>
335   <line lineNumber="99" executed="-3">
336     <body>     * @throws BankAccountException</body>
337   </line>
338   <line lineNumber="100" executed="-3">
339     <body>     */</body>
340   </line>
341   <line lineNumber="101" executed="-3">
342     <body>    public function depositMoney($balance)</body>
343   </line>
344   <line lineNumber="102" executed="-3">
345     <body>    {</body>
346   </line>
347   <line lineNumber="103" executed="1">
348     <body>        $this-&gt;setBalance($this-&gt;getBalance() + $balance);</body>
349     <tests>
350       <test name="testBalanceCannotBecomeNegative2" status="0" class="BankAccountTest" fullPath="%s/BankAccountTest.php" shortenedPath="/BankAccountTest.php" line="106"/>
351     </tests>
352   </line>
353   <line lineNumber="104" executed="-3">
354     <body></body>
355   </line>
356   <line lineNumber="105" executed="-1">
357     <body>        return $this-&gt;getBalance();</body>
358   </line>
359   <line lineNumber="106" executed="-2">
360     <body>    }</body>
361   </line>
362   <line lineNumber="107" executed="-3">
363     <body></body>
364   </line>
365   <line lineNumber="108" executed="-3">
366     <body>    /**</body>
367   </line>
368   <line lineNumber="109" executed="-3">
369     <body>     * Withdraws an amount of money from the bank account.</body>
370   </line>
371   <line lineNumber="110" executed="-3">
372     <body>     *</body>
373   </line>
374   <line lineNumber="111" executed="-3">
375     <body>     * @param  float $balance</body>
376   </line>
377   <line lineNumber="112" executed="-3">
378     <body>     * @throws BankAccountException</body>
379   </line>
380   <line lineNumber="113" executed="-3">
381     <body>     */</body>
382   </line>
383   <line lineNumber="114" executed="-3">
384     <body>    public function withdrawMoney($balance)</body>
385   </line>
386   <line lineNumber="115" executed="-3">
387     <body>    {</body>
388   </line>
389   <line lineNumber="116" executed="1">
390     <body>        $this-&gt;setBalance($this-&gt;getBalance() - $balance);</body>
391     <tests>
392       <test name="testBalanceCannotBecomeNegative" status="0" class="BankAccountTest" fullPath="%s/BankAccountTest.php" shortenedPath="/BankAccountTest.php" line="86"/>
393     </tests>
394   </line>
395   <line lineNumber="117" executed="-3">
396     <body></body>
397   </line>
398   <line lineNumber="118" executed="-1">
399     <body>        return $this-&gt;getBalance();</body>
400   </line>
401   <line lineNumber="119" executed="-2">
402     <body>    }</body>
403   </line>
404   <line lineNumber="120" executed="-3">
405     <body>}</body>
406   </line>
407   <line lineNumber="121" executed="-3">
408     <body>?&gt;</body>
409   </line>
410 </coveredFile>
411 <?xml version="1.0" encoding="UTF-8"?>
412 <testFile fullPath="%s/BankAccountTest.php" shortenedPath="BankAccountTest.php" generated="%i" phpunit="%s">
413   <line lineNumber="1">
414     <body>&lt;?php</body>
415   </line>
416   <line lineNumber="2">
417     <body>/**</body>
418   </line>
419   <line lineNumber="3">
420     <body> * PHPUnit</body>
421   </line>
422   <line lineNumber="4">
423     <body> *</body>
424   </line>
425   <line lineNumber="5">
426     <body> * Copyright (c) 2002-2009, Sebastian Bergmann &lt;sb@sebastian-bergmann.de&gt;.</body>
427   </line>
428   <line lineNumber="6">
429     <body> * All rights reserved.</body>
430   </line>
431   <line lineNumber="7">
432     <body> *</body>
433   </line>
434   <line lineNumber="8">
435     <body> * Redistribution and use in source and binary forms, with or without</body>
436   </line>
437   <line lineNumber="9">
438     <body> * modification, are permitted provided that the following conditions</body>
439   </line>
440   <line lineNumber="10">
441     <body> * are met:</body>
442   </line>
443   <line lineNumber="11">
444     <body> *</body>
445   </line>
446   <line lineNumber="12">
447     <body> *   * Redistributions of source code must retain the above copyright</body>
448   </line>
449   <line lineNumber="13">
450     <body> *     notice, this list of conditions and the following disclaimer.</body>
451   </line>
452   <line lineNumber="14">
453     <body> *</body>
454   </line>
455   <line lineNumber="15">
456     <body> *   * Redistributions in binary form must reproduce the above copyright</body>
457   </line>
458   <line lineNumber="16">
459     <body> *     notice, this list of conditions and the following disclaimer in</body>
460   </line>
461   <line lineNumber="17">
462     <body> *     the documentation and/or other materials provided with the</body>
463   </line>
464   <line lineNumber="18">
465     <body> *     distribution.</body>
466   </line>
467   <line lineNumber="19">
468     <body> *</body>
469   </line>
470   <line lineNumber="20">
471     <body> *   * Neither the name of Sebastian Bergmann nor the names of his</body>
472   </line>
473   <line lineNumber="21">
474     <body> *     contributors may be used to endorse or promote products derived</body>
475   </line>
476   <line lineNumber="22">
477     <body> *     from this software without specific prior written permission.</body>
478   </line>
479   <line lineNumber="23">
480     <body> *</body>
481   </line>
482   <line lineNumber="24">
483     <body> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</body>
484   </line>
485   <line lineNumber="25">
486     <body> * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</body>
487   </line>
488   <line lineNumber="26">
489     <body> * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS</body>
490   </line>
491   <line lineNumber="27">
492     <body> * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE</body>
493   </line>
494   <line lineNumber="28">
495     <body> * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,</body>
496   </line>
497   <line lineNumber="29">
498     <body> * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,</body>
499   </line>
500   <line lineNumber="30">
501     <body> * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</body>
502   </line>
503   <line lineNumber="31">
504     <body> * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</body>
505   </line>
506   <line lineNumber="32">
507     <body> * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</body>
508   </line>
509   <line lineNumber="33">
510     <body> * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN</body>
511   </line>
512   <line lineNumber="34">
513     <body> * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE</body>
514   </line>
515   <line lineNumber="35">
516     <body> * POSSIBILITY OF SUCH DAMAGE.</body>
517   </line>
518   <line lineNumber="36">
519     <body> *</body>
520   </line>
521   <line lineNumber="37">
522     <body> * @category   Testing</body>
523   </line>
524   <line lineNumber="38">
525     <body> * @package    PHPUnit</body>
526   </line>
527   <line lineNumber="39">
528     <body> * @author     Sebastian Bergmann &lt;sb@sebastian-bergmann.de&gt;</body>
529   </line>
530   <line lineNumber="40">
531     <body> * @copyright  2002-2009 Sebastian Bergmann &lt;sb@sebastian-bergmann.de&gt;</body>
532   </line>
533   <line lineNumber="41">
534     <body> * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License</body>
535   </line>
536   <line lineNumber="42">
537     <body> * @version    SVN: $%s$</body>
538   </line>
539   <line lineNumber="43">
540     <body> * @link       http://www.phpunit.de/</body>
541   </line>
542   <line lineNumber="44">
543     <body> * @since      File available since Release 2.3.0</body>
544   </line>
545   <line lineNumber="45">
546     <body> */</body>
547   </line>
548   <line lineNumber="46">
549     <body></body>
550   </line>
551   <line lineNumber="47">
552     <body>require_once 'PHPUnit/Framework/TestCase.php';</body>
553   </line>
554   <line lineNumber="48">
555     <body>require_once 'BankAccount.php';</body>
556   </line>
557   <line lineNumber="49">
558     <body></body>
559   </line>
560   <line lineNumber="50">
561     <body>/**</body>
562   </line>
563   <line lineNumber="51">
564     <body> * Tests for the BankAccount class.</body>
565   </line>
566   <line lineNumber="52">
567     <body> *</body>
568   </line>
569   <line lineNumber="53">
570     <body> * @category   Testing</body>
571   </line>
572   <line lineNumber="54">
573     <body> * @package    PHPUnit</body>
574   </line>
575   <line lineNumber="55">
576     <body> * @author     Sebastian Bergmann &lt;sb@sebastian-bergmann.de&gt;</body>
577   </line>
578   <line lineNumber="56">
579     <body> * @copyright  2002-2009 Sebastian Bergmann &lt;sb@sebastian-bergmann.de&gt;</body>
580   </line>
581   <line lineNumber="57">
582     <body> * @license    http://www.opensource.org/licenses/bsd-license.php  BSD License</body>
583   </line>
584   <line lineNumber="58">
585     <body> * @version    Release: %s</body>
586   </line>
587   <line lineNumber="59">
588     <body> * @link       http://www.phpunit.de/</body>
589   </line>
590   <line lineNumber="60">
591     <body> * @since      Class available since Release 2.3.0</body>
592   </line>
593   <line lineNumber="61">
594     <body> */</body>
595   </line>
596   <line lineNumber="62">
597     <body>class BankAccountTest extends PHPUnit_Framework_TestCase</body>
598   </line>
599   <line lineNumber="63">
600     <body>{</body>
601   </line>
602   <line lineNumber="64">
603     <body>    protected $ba;</body>
604   </line>
605   <line lineNumber="65">
606     <body></body>
607   </line>
608   <line lineNumber="66">
609     <body>    protected function setUp()</body>
610   </line>
611   <line lineNumber="67">
612     <body>    {</body>
613   </line>
614   <line lineNumber="68">
615     <body>        $this-&gt;ba = new BankAccount;</body>
616   </line>
617   <line lineNumber="69">
618     <body>    }</body>
619   </line>
620   <line lineNumber="70">
621     <body></body>
622   </line>
623   <line lineNumber="71">
624     <body>    /**</body>
625   </line>
626   <line lineNumber="72">
627     <body>     * @covers BankAccount::getBalance</body>
628   </line>
629   <line lineNumber="73">
630     <body>     * @group balanceIsInitiallyZero</body>
631   </line>
632   <line lineNumber="74">
633     <body>     * @group specification</body>
634   </line>
635   <line lineNumber="75">
636     <body>     */</body>
637   </line>
638   <line lineNumber="76">
639     <body>    public function testBalanceIsInitiallyZero()</body>
640     <coveredFiles>
641       <coveredFile fullPath="%s/BankAccountTest.php" shortenedPath="BankAccount.php">
642         <coveredLine>77</coveredLine>
643       </coveredFile>
644     </coveredFiles>
645   </line>
646   <line lineNumber="77">
647     <body>    {</body>
648   </line>
649   <line lineNumber="78">
650     <body>        $this-&gt;assertEquals(0, $this-&gt;ba-&gt;getBalance());</body>
651   </line>
652   <line lineNumber="79">
653     <body>    }</body>
654   </line>
655   <line lineNumber="80">
656     <body></body>
657   </line>
658   <line lineNumber="81">
659     <body>    /**</body>
660   </line>
661   <line lineNumber="82">
662     <body>     * @covers BankAccount::withdrawMoney</body>
663   </line>
664   <line lineNumber="83">
665     <body>     * @group balanceCannotBecomeNegative</body>
666   </line>
667   <line lineNumber="84">
668     <body>     * @group specification</body>
669   </line>
670   <line lineNumber="85">
671     <body>     */</body>
672   </line>
673   <line lineNumber="86">
674     <body>    public function testBalanceCannotBecomeNegative()</body>
675     <coveredFiles>
676       <coveredFile fullPath="%s/BankAccountTest.php" shortenedPath="BankAccount.php">
677         <coveredLine>116</coveredLine>
678       </coveredFile>
679     </coveredFiles>
680   </line>
681   <line lineNumber="87">
682     <body>    {</body>
683   </line>
684   <line lineNumber="88">
685     <body>        try {</body>
686   </line>
687   <line lineNumber="89">
688     <body>            $this-&gt;ba-&gt;withdrawMoney(1);</body>
689   </line>
690   <line lineNumber="90">
691     <body>        }</body>
692   </line>
693   <line lineNumber="91">
694     <body></body>
695   </line>
696   <line lineNumber="92">
697     <body>        catch (BankAccountException $e) {</body>
698   </line>
699   <line lineNumber="93">
700     <body>            $this-&gt;assertEquals(0, $this-&gt;ba-&gt;getBalance());</body>
701   </line>
702   <line lineNumber="94">
703     <body></body>
704   </line>
705   <line lineNumber="95">
706     <body>            return;</body>
707   </line>
708   <line lineNumber="96">
709     <body>        }</body>
710   </line>
711   <line lineNumber="97">
712     <body></body>
713   </line>
714   <line lineNumber="98">
715     <body>        $this-&gt;fail();</body>
716   </line>
717   <line lineNumber="99">
718     <body>    }</body>
719   </line>
720   <line lineNumber="100">
721     <body></body>
722   </line>
723   <line lineNumber="101">
724     <body>    /**</body>
725   </line>
726   <line lineNumber="102">
727     <body>     * @covers BankAccount::depositMoney</body>
728   </line>
729   <line lineNumber="103">
730     <body>     * @group balanceCannotBecomeNegative</body>
731   </line>
732   <line lineNumber="104">
733     <body>     * @group specification</body>
734   </line>
735   <line lineNumber="105">
736     <body>     */</body>
737   </line>
738   <line lineNumber="106">
739     <body>    public function testBalanceCannotBecomeNegative2()</body>
740     <coveredFiles>
741       <coveredFile fullPath="%s/BankAccountTest.php" shortenedPath="BankAccount.php">
742         <coveredLine>103</coveredLine>
743       </coveredFile>
744     </coveredFiles>
745   </line>
746   <line lineNumber="107">
747     <body>    {</body>
748   </line>
749   <line lineNumber="108">
750     <body>        try {</body>
751   </line>
752   <line lineNumber="109">
753     <body>            $this-&gt;ba-&gt;depositMoney(-1);</body>
754   </line>
755   <line lineNumber="110">
756     <body>        }</body>
757   </line>
758   <line lineNumber="111">
759     <body></body>
760   </line>
761   <line lineNumber="112">
762     <body>        catch (BankAccountException $e) {</body>
763   </line>
764   <line lineNumber="113">
765     <body>            $this-&gt;assertEquals(0, $this-&gt;ba-&gt;getBalance());</body>
766   </line>
767   <line lineNumber="114">
768     <body></body>
769   </line>
770   <line lineNumber="115">
771     <body>            return;</body>
772   </line>
773   <line lineNumber="116">
774     <body>        }</body>
775   </line>
776   <line lineNumber="117">
777     <body></body>
778   </line>
779   <line lineNumber="118">
780     <body>        $this-&gt;fail();</body>
781   </line>
782   <line lineNumber="119">
783     <body>    }</body>
784   </line>
785   <line lineNumber="120">
786     <body></body>
787   </line>
788   <line lineNumber="121">
789     <body>    /**</body>
790   </line>
791   <line lineNumber="122">
792     <body>     * @covers BankAccount::getBalance</body>
793   </line>
794   <line lineNumber="123">
795     <body>     * @covers BankAccount::depositMoney</body>
796   </line>
797   <line lineNumber="124">
798     <body>     * @covers BankAccount::withdrawMoney</body>
799   </line>
800   <line lineNumber="125">
801     <body>     * @group balanceCannotBecomeNegative</body>
802   </line>
803   <line lineNumber="126">
804     <body>     */</body>
805   </line>
806   <line lineNumber="127">
807     <body>/*</body>
808   </line>
809   <line lineNumber="128">
810     <body>    public function testDepositWithdrawMoney()</body>
811   </line>
812   <line lineNumber="129">
813     <body>    {</body>
814   </line>
815   <line lineNumber="130">
816     <body>        $this-&gt;assertEquals(0, $this-&gt;ba-&gt;getBalance());</body>
817   </line>
818   <line lineNumber="131">
819     <body>        $this-&gt;ba-&gt;depositMoney(1);</body>
820   </line>
821   <line lineNumber="132">
822     <body>        $this-&gt;assertEquals(1, $this-&gt;ba-&gt;getBalance());</body>
823   </line>
824   <line lineNumber="133">
825     <body>        $this-&gt;ba-&gt;withdrawMoney(1);</body>
826   </line>
827   <line lineNumber="134">
828     <body>        $this-&gt;assertEquals(0, $this-&gt;ba-&gt;getBalance());</body>
829   </line>
830   <line lineNumber="135">
831     <body>    }</body>
832   </line>
833   <line lineNumber="136">
834     <body>*/</body>
835   </line>
836   <line lineNumber="137">
837     <body>}</body>
838   </line>
839   <line lineNumber="138">
840     <body>?&gt;</body>
841   </line>
842 </testFile>