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 getTests() { // No resultant package $targetPackage = $this->getTargetPackage(); if (!$targetPackage) { return false; } // No tests $tests = $targetPackage->getTests(); if (empty($tests)) { return false; } // Make battery $battery = new Engine_Sanity(array('name' => $targetPackage->getKey())); foreach ($tests as $test) { $battery->addTest($test->toArray()); } return $battery; }
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; }