public function testParseSpecialChannelEvent() { $file = $this->getMock('SplTempFileObject', array('fseek')); $bytes = $this->onConsecutiveCalls(pack('C', 0xc0), pack('C', 0x64), pack('C', 0x64), pack('C', 0x64)); $event1 = $this->getMock('Tmont\\Midi\\Event\\ChannelEvent', array('getType', 'getParamDescription'), array(), '', false); $event2 = $this->getMock('Tmont\\Midi\\Event\\ChannelEvent', array('setContinuation', 'getType', 'getParamDescription'), array(), '', false); $event2->expects($this->once())->method('setContinuation'); $channelEventFactory = $this->getMock('Tmont\\Midi\\Event\\EventFactory', array('createChannelEvent')); $channelEventFactory->expects($this->exactly(2))->method('createChannelEvent')->with(0xc0, 0x0, 0x64, null)->will($this->onConsecutiveCalls($event1, $event2)); //normal channel event $this->obj = $this->getMock('Tmont\\Midi\\Parsing\\EventParser', array('read'), array($channelEventFactory)); $this->obj->expects($this->exactly(4))->method('read')->will($bytes); //continuation event $file->expects($this->once())->method('fseek')->with(-1, SEEK_CUR); $this->obj->setFile($file); $this->assertEquals($event1, $this->obj->parse()); $this->assertEquals($event2, $this->obj->parse()); }
/** * @since 1.0 * @uses EventParser::setFile() * @uses DeltaParser::setFile() */ protected function afterSetFile() { $this->eventParser->setFile($this->file); $this->deltaParser->setFile($this->file); }