public function testEntityHydratorCanHydrate()
 {
     $data = ['name' => 'fooName', 'description' => 'fooDescription', 'url' => 'fooUrl', 'owner' => 'fooOwner', 'module_id' => 999, 'created_at' => '2013-02-28 13:05:00', 'updated_at' => '2014-05-10 06:48:15', 'photo_url' => 'fooPhotoUrl'];
     $module = new Module();
     $module->setCreatedAt('2013-02-28 13:05:00');
     $module->setUpdatedAt('2014-05-10 06:48:15');
     $module->setDescription('fooDescription');
     $module->setId(999);
     $module->setName('fooName');
     $module->setOwner('fooOwner');
     $module->setPhotoUrl('fooPhotoUrl');
     $module->setUrl('fooUrl');
     $hydrator = new ModuleHydrator();
     $this->assertEquals($module, $hydrator->hydrate($data, new Module()));
 }
 /**
  * @param ModuleEntity $module
  * @return Entry
  */
 public function addModule(ModuleEntity $module)
 {
     $moduleDescription = $module->getDescription();
     if (empty($moduleDescription)) {
         $moduleDescription = 'No description available';
     }
     $moduleName = $module->getName();
     $urlParams = ['vendor' => $module->getOwner(), 'module' => $moduleName];
     $entry = $this->feed->createEntry();
     $entry->setId($module->getIdentifier());
     $entry->setTitle($moduleName);
     $entry->setDescription($moduleDescription);
     $entry->setLink($this->urlPlugin->fromRoute('view-module', $urlParams, ['force_canonical' => true]));
     $entry->addAuthor(['name' => $module->getOwner()]);
     $entry->setDateCreated($module->getCreatedAtDateTime());
     $this->feed->addEntry($entry);
     return $entry;
 }
 /**
  * @param stdClass $repository
  * @return Entity\Module
  */
 public function register($repository)
 {
     $isUpdate = false;
     $module = $this->moduleMapper->findByUrl($repository->html_url);
     if ($module) {
         $isUpdate = true;
     } else {
         $module = new Entity\Module();
     }
     $module->setName($repository->name);
     $module->setDescription($repository->description);
     $module->setUrl($repository->html_url);
     $module->setOwner($repository->owner->login);
     $module->setPhotoUrl($repository->owner->avatar_url);
     if ($isUpdate) {
         $this->moduleMapper->update($module);
     } else {
         $this->moduleMapper->insert($module);
     }
     return $module;
 }
 /**
  * @return Entity\Module
  */
 private function module()
 {
     $module = new Entity\Module();
     $module->setName('');
     $module->setOwner('');
     $module->setDescription('');
     $module->setUrl('');
     return $module;
 }
 public function testGetNullIdentifierOnlyName()
 {
     $this->module->setName('name');
     $this->assertNull($this->module->getIdentifier());
 }