public function sanityAction()
 {
     // Get db
     if (Zend_Registry::isRegistered('Zend_Db') && ($db = Zend_Registry::get('Zend_Db')) instanceof Zend_Db_Adapter_Abstract) {
         Engine_Sanity::setDefaultDbAdapter($db);
     }
     // Get packages
     $packages = $this->_packageManager->listInstalledPackages();
     // Get dependencies
     $this->view->dependencies = $dependencies = $this->_packageManager->depend();
     // Get tests
     $this->view->tests = $tests = new Engine_Sanity();
     $packageIndex = array();
     foreach ($packages as $package) {
         $packageTests = $package->getTests();
         // No tests
         if (empty($packageTests)) {
             continue;
         }
         $packageIndex[$package->getKey()] = $package;
         // Make battery
         $battery = new Engine_Sanity(array('name' => $package->getKey()));
         foreach ($packageTests as $test) {
             $battery->addTest($test->toArray());
         }
         $tests->addTest($battery);
     }
     $this->view->packageIndex = $packageIndex;
     $tests->run();
 }
 public function dbSanityAction()
 {
     // Leave if not ready
     if (empty($this->_session->mysql)) {
         return $this->_helper->redirector->gotoRoute(array('action' => 'db-info'));
     }
     // Connect
     try {
         $config = $this->dbFormToConfig($this->_session->mysql);
         $adapter = Zend_Db::factory($config['adapter'], $config['params']);
         $adapter->getServerVersion();
     } catch (Exception $e) {
         $this->view->error = 'Adapter Error: ' . $e->getMessage();
         if (APPLICATION_ENV == 'development') {
             echo $e;
         }
         return;
     }
     // Run sanity
     $this->view->test = $test = new Engine_Sanity(array('tests' => array(array('type' => 'MysqlServer', 'name' => 'MySQL 4.1', 'adapter' => $adapter, 'minVersion' => '4.1'), array('type' => 'MysqlEngine', 'name' => 'MySQL InnoDB Storage Engine', 'adapter' => $adapter, 'engine' => 'innodb'))));
     $test->run();
     $this->view->maxErrorLevel = $maxErrorLevel = $test->getMaxErrorLevel();
     $this->_session->db_sanity = array('maxErrorLevel' => $maxErrorLevel);
 }
示例#3
0
文件: Manager.php 项目: robeendey/ce
 public function test($transaction)
 {
     // Verify transaction
     $transaction = $this->_verifyTransaction($transaction);
     // Check registry for db adapter
     if (Zend_Registry::isRegistered('Zend_Db') && ($db = Zend_Registry::get('Zend_Db')) instanceof Zend_Db_Adapter_Abstract) {
         Engine_Sanity::setDefaultDbAdapter($db);
     }
     // Make tests
     $batteries = new Engine_Sanity();
     foreach ($transaction as $operation) {
         $battery = $operation->getTests();
         if ($battery) {
             $batteries->addTest($battery);
         }
         unset($operation);
     }
     $batteries->run();
     return $batteries;
 }