Exemple #1
0
 /**
  * @test
  */
 public function shouldGetAndSet()
 {
     $this->assertEquals(count($this->images), count($this->collection->getImages()));
     /**
      * @var Image $subject
      */
     $results = $this->collection->toArray();
     $subject = array_pop($results);
     $this->assertEquals('/abc.jpg', $subject->getFilePath());
     $this->assertEquals(1000, $subject->getWidth());
     $this->assertEquals(750, $subject->getHeight());
     $this->assertEquals('en', $subject->getIso6391());
     $this->assertEquals(0.75, $subject->getAspectRatio());
     $this->assertEquals(2.25, $subject->getVoteAverage());
     $this->assertEquals(25, $subject->getVoteCount());
 }
Exemple #2
0
 /**
  * @test
  */
 public function shouldFilterMaxWidth()
 {
     $this->setUp();
     $images = $this->images->filterMaxWidth(1000);
     $this->assertEquals(false, empty($images));
     /**
      * @var Image $image
      */
     foreach ($images as $image) {
         $this->assertEquals(true, $image->getWidth() <= 1000);
     }
 }
Exemple #3
0
 /**
  * Create full collection
  *
  * @param  array  $data
  * @return Images
  */
 public function createImageCollection(array $data = array())
 {
     $collection = new Images();
     foreach ($data as $format => $formatCollection) {
         if (!is_array($formatCollection)) {
             continue;
         }
         foreach ($formatCollection as $item) {
             if (array_key_exists($format, Image::$formats)) {
                 $item = $this->create($item, $format);
                 $collection->addImage($item);
             }
         }
     }
     return $collection;
 }