Example #1
0
 public function testGetImageSpecs()
 {
     $rendition = new Rendition(200, 200, 'crop', 'test');
     $this->package->setRendition($rendition);
     $item = new Item($this->package, new LocalImage('test'));
     $item->setCoords('0_0_200_200');
     $this->assertEquals('crop_0_0_200_200', $item->getImageSpecs());
 }
Example #2
0
 public function testReloadRenditions()
 {
     $this->service->getRenditions();
     $rendition = new Rendition(300, 200, 'crop', 'old');
     $rendition2 = new Rendition(300, 200, 'crop', 'packaged');
     $image = new LocalImage(self::PICTURE_PORTRAIT);
     $this->orm->persist($rendition);
     $this->orm->persist($rendition2);
     $this->orm->persist($image);
     $this->orm->flush();
     $package = new \Newscoop\Package\Package();
     $package->setHeadline('test');
     $package->setRendition($rendition2);
     $this->orm->persist($package);
     $this->orm->flush();
     $this->service->setArticleRendition(self::ARTICLE_NUMBER, $rendition, $image);
     $this->service->reloadRenditions();
     $this->assertEquals(6, count($this->service->getRenditions()));
     $this->assertFalse(array_key_exists('old', $this->service->getRenditions()));
     $this->assertTrue(array_key_exists('packaged', $this->service->getRenditions()));
     $articleRenditions = $this->service->getArticleRenditions(self::ARTICLE_NUMBER);
     $this->assertFalse($articleRenditions->offsetExists($rendition));
 }