2009/10/11 Eric Bauman <baum...@livejournal.dk>:

> As before, please feel free to insult my code. ;-) Any and all feedback is
> of course most appreciated.

I know you're more concerned with structure, but your checkInt()
method is arguably buggy/has an un-noted assumption. It accepts ints
formatted as ints and strings, but not floats:

<?php

require_once 'PHPUnit/Framework/TestCase.php';
require_once 'BankModel.php';

class BankModelTest extends PHPUnit_Framework_TestCase
{
    function testSetBalanceAcceptsInts()
    {
        $fixture = new BankModel();
        $int = 1351236;
        $this->assertNull( $fixture->setBalance($int) );
    }

    function testSetBalanceAcceptsFloats()
    {
        $fixture = new BankModel();
        $float = (float)1351236;
        $this->assertNull( $fixture->setBalance($float) );
    }

    function testSetBalanceAcceptsStrings()
    {
        $fixture = new BankModel();
        $string = (string)1351236;
        $this->assertNull( $fixture->setBalance($string) );
    }
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to