Пример #1
0
 /**
  * Check & validate the category parameter
  * @param  Validate $validate Validate instance
  * @param  Task $task Download task
  * @param  string $option Option value
  */
 public function categoryParameter(Validate $validate, Task $task, $option)
 {
     $category = $validate->category($option);
     $task->setCategory($category);
     if (is_int($category) && $task->getFeatured() !== true) {
         $this->verboseOutput('Download only photos for category ID ' . $option . '.' . PHP_EOL);
     }
 }
Пример #2
0
 /**
  * Test Simondubois\UnsplashDownloader\Task::notify()
  */
 public function testNotify()
 {
     // Instantiate task
     $task = new Task();
     // Callback
     $callback = $this->getMock('stdClass', ['callback']);
     $callback->expects($this->once())->method('callback')->with($this->identicalTo('message'), $this->identicalTo('level'));
     // Assert
     $task->setNotificationCallback([$callback, 'callback']);
     $task->notify('message', 'level');
 }