Example #1
0
        $mock->expectArgumentsAt(1, "aMethod", array("Hello"));
        $mock->aMethod(1, 2);
        $mock->aMethod("Goodbye");
    }
    function testBadArgParameter()
    {
        $mock =& new MockDummy($this);
        $mock->expectArguments("aMethod", "foo");
        $this->assertErrorPattern('/\\$args.*not an array/i');
        $mock->aMethod();
        $mock->tally();
    }
}
SimpleTestOptions::addPartialMockCode('function sayHello() { return "Hello"; }');
Mock::generatePartial("Dummy", "TestDummy", array("anotherMethod"));
SimpleTestOptions::addPartialMockCode();
class TestOfPartialMocks extends UnitTestCase
{
    function TestOfPartialMocks()
    {
        $this->UnitTestCase();
    }
    function testMethodReplacement()
    {
        $mock =& new TestDummy($this);
        $this->assertEqual($mock->aMethod(99), 99);
        $this->assertNull($mock->anotherMethod());
    }
    function testSettingReturns()
    {
        $mock =& new TestDummy($this);