You can also test a partial layout of an object over a period of time until the DI system is installed.
class Foo { function getCurrentBar() { $model = $this->getQueryResult($this->getSession()->get('current_bar'));
Then run a test that is a bit like this ...
$myObjectToTest = $this->getMock('Foo', array('getQueryResult'), array(), '', true, true, true); $myObjectToTest->expects($this->once()) ->method('getQueryResult') ->with($whateverTheQueryParametersAre) ->will($this->returnValue($someResult)); $myObjectToTest->getCurrentBar();
source share