function testComplicatedReturnSequence() { $mock = new MockDummy(); $object = new Dummy(); $mock->setReturnValueAt(1, "aMethod", "aaa", array("a")); $mock->setReturnValueAt(1, "aMethod", "bbb"); $mock->setReturnReferenceAt(2, "aMethod", $object, array('*', 2)); $mock->setReturnValueAt(2, "aMethod", "value", array('*', 3)); $mock->setReturnValue("aMethod", 3, array(3)); $this->assertNull($mock->aMethod()); $this->assertEqual($mock->aMethod("a"), "aaa"); $this->assertReference($zref =& $mock->aMethod(1, 2), $object); $this->assertEqual($mock->aMethod(3), 3); $this->assertNull($mock->aMethod()); }
function testSetReturnReferenceAtGivesOriginal() { $mock = new MockDummy(); $object = 100; $mock->setReturnReferenceAt(1, "aReferenceMethod", $object); $this->assertNull($mock->aReferenceMethod()); $this->assertReference($mock->aReferenceMethod(), $object); $this->assertNull($mock->aReferenceMethod()); }
function testReturnReferenceSequence() { $mock = new MockDummy(); $object = new Dummy(); $mock->setReturnReferenceAt(1, 'aMethod', $object); $this->assertNull($mock->aMethod()); $this->assertReference($zref =& $mock->aMethod(), $object); $this->assertNull($mock->aMethod()); $this->swallowErrors(); }