示例#1
0
 public function testLoad()
 {
     //i really don't care what method we mock here, i just need an instance of SplFileObject,
     //but PHP's reflection API returns $... for one of the parameter names of fscanf and it jacks
     //up PHPUnit's mock object generator
     //@see http://www.phpunit.de/ticket/1046
     $file = $this->getMock('SplTempFileObject', array('fgets'));
     $trackParser = $this->getMock('Tmont\\Midi\\Parsing\\TrackParser', array('setFile'), array(), '', false);
     //called by afterLoad()
     $trackParser->expects($this->once())->method('setFile')->with($file);
     $this->obj = new FileParser($trackParser);
     $this->obj->load($file);
 }
示例#2
0
文件: test.php 项目: tmont/midiparser
<?php

require_once dirname(dirname(__FILE__)) . '/vendor/autoload.php';
use Tmont\Midi\Parsing\FileParser;
use Tmont\Midi\Reporting\HtmlFormatter;
use Tmont\Midi\Reporting\MultiFilePrinter;
$file = dirname(__FILE__) . '/And_We_Die_Young.mid';
$parser = new FileParser();
$parser->load($file);
$formatter = new HtmlFormatter();
$formatter->setMultiFile(true);
$printer = new MultiFilePrinter($formatter, $parser, dirname(__FILE__) . '/test');
$printer->printAll();