示例#1
0
 public function testFindNoPhotoForACategory()
 {
     VCR::insertCassette('categories.yml');
     $category = Unsplash\Category::find(2);
     $photos = $category->photos(2000);
     VCR::eject();
     $this->assertEquals(0, $photos->count());
 }
 /**
  * Request APi to get last photos in category
  * @param  int $quantity Number of photos to return
  * @param  integer $category Category ID
  * @return string[] Photo download links indexed by IDs
  */
 public function photosInCategory($quantity, $category)
 {
     $photos = [];
     foreach (Category::find($category)->photos(1, $quantity) as $photo) {
         $photos[$photo->id] = $photo->links['download'];
     }
     return $photos;
 }