public function update()
 {
     // Load the $action for editing
     if (isset($_REQUEST['action_id']) && $_REQUEST['action_id']) {
         try {
             $action = new Action($_REQUEST['action_id']);
         } catch (\Exception $e) {
             $_SESSION['errorMessages'][] = $e;
             header('Location: ' . BASE_URL . '/actions');
             exit;
         }
     } else {
         $action = new Action();
     }
     if (isset($_POST['name'])) {
         $action->handleUpdate($_POST);
         try {
             $action->save();
             header('Location: ' . BASE_URL . '/actions');
             exit;
         } catch (\Exception $e) {
             $_SESSION['errorMessages'][] = $e;
         }
     }
     $this->template->blocks[] = new Block('actions/updateActionForm.inc', array('action' => $action));
 }
 public function testSaveAndLoad()
 {
     $action = new Action();
     $action->setName('Test');
     $action->setDescription('Description');
     $action->save();
     $id = $action->getId();
     $this->assertNotEmpty($id);
     $action = new Action($id);
     $this->assertEquals('Test', $action->getName());
     $this->assertEquals('Description', $action->getDescription());
 }