/**
  * Test Simondubois\UnsplashDownloader\Validate::history()
  */
 public function testValidHistory()
 {
     $validate = new Validate();
     $root = vfsStream::setup('test')->url();
     $existingFile = $root . '/existingFile';
     $missingFile = $root . '/missingFile';
     touch($existingFile);
     $this->assertNull($validate->history(null));
     $this->assertEquals($existingFile, $validate->history($existingFile));
     $this->assertEquals($missingFile, $validate->history($missingFile));
 }
Ejemplo n.º 2
0
 /**
  * Check & validate the history parameter
  * @param  Validate $validate Validate instance
  * @param  Task $task Download task
  * @param  string $option Option value
  */
 public function historyParameter(Validate $validate, Task $task, $option)
 {
     $history = $validate->history($option);
     $task->setHistory($history);
     if (is_null($history)) {
         $this->verboseOutput('Do not use history.' . PHP_EOL);
         return;
     }
     $this->verboseOutput('Use ' . $history . ' as history.' . PHP_EOL);
 }