public function testReadWithLessThanExpectedCount() { $file = $this->getMock('SplTempFileObject', array('fgetc', 'valid')); $file->expects($this->once())->method('fgetc')->will($this->returnValue('x')); $file->expects($this->exactly(2))->method('valid')->will($this->onConsecutiveCalls(true, false)); $this->obj = new FakeParser(); $this->obj->setFile($file); $this->assertEquals('x', $this->obj->testReadFalse()); }