コード例 #1
0
 public function test()
 {
     $strategy = m::mock('Distill\\Strategy\\StrategyInterface');
     $strategy->shouldReceive('getPreferredFilesOrdered')->andReturnUsing(function ($files) {
         return $files;
     })->getMock();
     $formatGuesser = m::mock('Distill\\FormatGuesserInterface');
     $formatGuesser->shouldReceive('guess')->andReturn(new Format\FormatChain([new Format\Composed\TarGz()]), new Format\FormatChain([new Format\Simple\Zip()]))->getMock();
     $preferredFiles = $this->chooser->setStrategy($strategy)->setFormatGuesser($formatGuesser)->setFiles(['test.tgz', 'test.zip'])->getPreferredFilesOrdered();
     $this->assertCount(1, $preferredFiles);
 }
コード例 #2
0
ファイル: ChooserTest.php プロジェクト: anthonyhowell/distill
 public function testExceptionWhenNoFormatGuesserIsDefined()
 {
     $this->setExpectedException('Distill\\Exception\\FormatGuesserRequiredException');
     $this->chooser->setFiles(['test.tgz', 'test.zip'])->getPreferredFile();
 }