/**
  * @covers \odTimeTracker\Model\ActivityMapper::update
  */
 public function testUpdate()
 {
     $mapper = new \odTimeTracker\Model\ActivityMapper(self::$pdo);
     $activities = self::getDataActivities();
     $activity1 = new \odTimeTracker\Model\ActivityEntity($activities[0]);
     $activity1->setName('(Updated) ' . $activity1->getName());
     $activity1->setDescription('(Updated) ' . $activity1->getDescription());
     $res1 = $mapper->update($activity1);
     $this->assertInstanceOf('\\odTimeTracker\\Model\\ActivityEntity', $res1);
     $this->assertEquals('(Updated) ' . $activities[0]['Name'], $res1->getName());
     $this->assertEquals('(Updated) ' . $activities[0]['Description'], $res1->getDescription());
     $activity2 = new \odTimeTracker\Model\ActivityEntity();
     $activity2->setName('Test activity');
     $res2 = $mapper->update($activity2);
     $this->assertFalse($res2);
 }
 /**
  * @covers \odTimeTracker\Model\ActivityEntity::exchangeArray
  */
 public function testExchangeArrayWithValues()
 {
     $activities = self::getDataActivities();
     foreach ($activities as $data) {
         $entity = new \odTimeTracker\Model\ActivityEntity();
         $entity->exchangeArray($data);
         $this->assertEquals($data['ActivityId'], $entity->getId());
         $this->assertEquals($data['ActivityId'], $entity->getActivityId());
         $this->assertEquals($data['ProjectId'], $entity->getProjectId());
         $this->assertEquals($data['Name'], $entity->getName());
         $this->assertEquals($data['Description'], $entity->getDescription());
         $this->assertEquals($data['Tags'], $entity->getTags());
         $this->assertEquals($data['Started'], $entity->getStarted());
         if (is_null($data['Stopped'])) {
             $this->assertNull($entity->getStopped());
         } else {
             $this->assertEquals($data['Stopped'], $entity->getStopped());
         }
     }
 }