コード例 #1
0
ファイル: CommandTest.php プロジェクト: aik099/svn-buddy
 /**
  * @dataProvider runWithCacheDataProvider
  */
 public function testRunWithExistingCache($duration, $invalidator, $use_callback, $is_xml)
 {
     if ($is_xml) {
         $command_line = 'svn log --xml';
         $process_output = '<log><logentry/></log>';
     } else {
         $command_line = 'svn log';
         $process_output = 'OK';
     }
     $callback_output = null;
     $callback = $this->createRunCallback($use_callback, $callback_output);
     $this->_process->getCommandLine()->willReturn($command_line)->shouldBeCalled();
     $this->_process->mustRun($callback)->shouldNotBeCalled();
     $this->_cacheManager->getCache('command:' . $command_line, $invalidator)->willReturn($process_output)->shouldBeCalled();
     $this->_cacheManager->setCache(Argument::any())->shouldNotBeCalled();
     if (isset($duration)) {
         $this->_command->setCacheDuration($duration);
     }
     if (isset($invalidator)) {
         $this->_command->setCacheInvalidator($invalidator);
     }
     $this->assertCommandOutput($callback, $is_xml, $process_output);
     if ($use_callback) {
         $this->assertEquals($process_output, $callback_output);
     }
 }