public function testFindAllCuratedBatches() { VCR::insertCassette('curated_batches.yml'); $curatedBatches = Unsplash\CuratedBatch::all(); VCR::eject(); $this->assertEquals(10, $curatedBatches->count()); }
/** * Request APi to get last featured photos * @param int $quantity Number of photos to return * @return string[] Photo download links indexed by ID */ public function featuredPhotos($quantity) { $photos = []; // process currated batches foreach (CuratedBatch::all(1, 100) as $batchInfo) { $batch = CuratedBatch::find($batchInfo->id); // process photos foreach ($batch->photos() as $photo) { $photos[$photo->id] = $photo->links['download']; // quit if $quantity photos have been found if (count($photos) >= $quantity) { break 2; } } } return $photos; }