public function showAction() { $searchTerm = $this->_request->getParam('search'); $sortKey = $this->_request->getParam('sort', 'unit'); $config = $this->getConfig()->toArray(); if (!isset($config['setup']['translation']['modules']['allowed'])) { $this->_redirectTo('error', array('failure' => 'setup_language_translation_modules_missing')); } $moduleNames = explode(',', $config['setup']['translation']['modules']['allowed']); $translationManager = new Setup_Model_Language_TranslationManager(); $translationManager->setModules($moduleNames); if (!empty($searchTerm)) { $translationManager->setFilter($searchTerm); } $this->view->form = $this->getSearchForm($searchTerm, $sortKey); $this->view->translations = $translationManager->getTranslations($sortKey); $this->view->sortKeys = $this->_sortKeys; $this->view->currentSortKey = $sortKey; $this->view->searchTerm = $searchTerm; }
/** * */ public function testSetFilter() { $filter = 'error'; $this->object->setModules(array('default')); $allTranlsations = $this->object->getTranslations(); $this->object->setFilter($filter); $filteredTranlsations = $this->object->getTranslations(); $this->assertLessThan(count($allTranlsations), count($filteredTranlsations), 'Expected count of filtered subset of translations to be less than all translations'); foreach ($filteredTranlsations as $translation) { $this->assertTrue(strpos($translation['unit'], $filter) !== false, 'Expected filtered translation unit to contain filter string'); } }