public function testSubdefinitionsCanBeAddedAndRetrieved()
 {
     $map = new DefinitionMap();
     $map->addMapping('bacon', 'high-res');
     $this->assertEquals('high-res', $map->getSubDefinition('bacon'));
     $this->assertEquals('high-res', $map->getSubDefinition('bacon', 'default'));
 }
 /**
  * Fetch correct thumbnail according to type (medium or large)
  *
  * @param Record|Story $record Record for which to fetch the thumbnail
  * @param string $type Size of the thumbnail
  * @return null|\PhraseanetSDK\Entity\Subdef
  * @throws \InvalidArgumentException
  */
 public function fetch($record, $type)
 {
     if (!$record instanceof Record && !$record instanceof Story) {
         throw new \InvalidArgumentException();
     }
     if (!$this->thumbnailMap->hasSubDefinition($type) || $record instanceof Story) {
         return $record->getThumbnail();
     }
     $subdefinition = $this->thumbnailMap->getSubDefinition($type);
     if ($record->getSubdefs()->containsKey($subdefinition)) {
         return $record->getSubdefs()->get($subdefinition);
     }
     return $record->getThumbnail();
 }