/** * Test Simondubois\UnsplashDownloader\Validate::category() */ public function testValidCategory() { $validate = new Validate(); $this->assertNull($validate->category(null)); $this->assertEquals(1, $validate->category('1')); $this->assertEquals(0, $validate->category('abc')); }
/** * 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); } }