public function testUpgradeTariffTemplate()
 {
     $oldTariffTemplate = $this->_templateService->load($this->_oldTariffTemplate['_id']);
     //Initialize db for use in included script
     $db = $this->_db;
     include App::getApplicationPath() . '/../scripts/updates/02.00rev20130312.php';
     /**
      * @var \Application\Model\TemplateModel $upgradedTariffTemplate
      */
     $upgradedTariffTemplate = $this->_templateService->load($this->_oldTariffTemplate['_id']);
     $this->assertNotNull($upgradedTariffTemplate->name);
     $this->assertNotNull($upgradedTariffTemplate->organizationId);
     $this->assertNotNull($upgradedTariffTemplate->type);
     $this->assertNotNull($upgradedTariffTemplate->id);
     $this->assertNotNull($upgradedTariffTemplate->modified);
     $this->assertNotNull($upgradedTariffTemplate->zonePlanId);
     $this->assertNotNull($upgradedTariffTemplate->zonePlan);
     $zonePlan = $upgradedTariffTemplate->zonePlan;
     $zoneGroup = $zonePlan['zoneGroups'][0];
     $this->assertNotNull($zoneGroup['id']);
     $this->assertNotNull($zoneGroup['name']);
     $this->assertNotNull($zoneGroup['zones']);
     $this->assertEquals(1, count($zoneGroup['zones']));
     $this->assertEquals($zoneGroup['zones'][0], 2);
     $termVoice = current($upgradedTariffTemplate->termVoice);
     $this->assertNull($termVoice['zoneId']);
     $this->assertNotNull($termVoice['zoneGroupId']);
     $this->assertNotNull($termVoice['zoneGroupName']);
 }
 /**
  */
 public function deleteAction()
 {
     // Try to load the chosen user
     $templateId = $this->getRequest()->getParam('id');
     $template = $this->_templateSrv->load($templateId);
     if (empty($template)) {
         throw new AppEx\NotFoundException('Template ' . $templateId . ' not found', 404);
     }
     // Check permissions
     $this->_helper->allowed('delete', $template);
     // Remove the user
     $this->_templateSrv->delete($templateId);
     $this->view->data = true;
 }