protected function Form_Create() { $filesToSkip = array("QUnitTestCaseBase.php", "QTestForm.tpl.php"); $arrFiles = QFolder::listFilesInFolder(__QCUBED_CORE__ . '/tests/qcubed-unit/'); $arrTests = array(); foreach ($arrFiles as $filename) { if (!in_array($filename, $filesToSkip)) { require_once __QCUBED_CORE__ . '/tests/qcubed-unit/' . $filename; $arrTests[] = str_replace(".php", "", $filename); } } $suite = new TestSuite('QCubed ' . QCUBED_VERSION_NUMBER_ONLY . ' Unit Tests - SimpleTest ' . SimpleTest::getVersion()); foreach ($arrTests as $className) { $suite->add(new $className($this)); } $suite->run(new QHtmlReporter()); }
public function addComponents($arrComponents) { if (is_array($arrComponents) && sizeof($arrComponents) > 0) { foreach ($arrComponents as $item) { if (!$item instanceof QPluginComponent) { throw new Exception("The following item is not a QPluginComponent: " . var_export($item, true)); } // Make the component aware of its hosting QPlugin $item->registerPlugin($this); if (!$item->validate()) { throw new Exception("The following plugin component does not validate: " . $item->__toString() . ". Error: " . $item->strValidationError); } if ($item instanceof QPluginFile) { $fullPath = $this->strTemporaryExpandedPath . $item->strFilename; if (is_dir($fullPath)) { $folderContents = QFolder::listFilesInFolder($fullPath); foreach ($folderContents as $file) { $itemClass = get_class($item); $newComponent = new $itemClass($item->strFilename . "/" . $file); $this->addFile($newComponent); } } else { $this->addFile($item); } } else { if ($item instanceof QPluginIncludedClass) { $this->addIncludedClass($item); } else { if ($item instanceof QPluginExample) { $this->addExample($item); } else { throw new Exception("Unknown item type: " . var_export($item, true)); } } } } } else { throw new Exception("addFiles only accepts an array of QPluginFile objects"); } }
<?php require_once '../qcubed.inc.php'; QApplication::CheckRemoteAdmin(); echo "<h2>Unattended Plugin Installer</h2>"; echo "<p><em>" . QDateTime::NowToString(QDateTime::FormatDisplayDateTime) . "</em></p>"; $directory = __INCLUDES__ . '/tmp/plugin.install'; $arrFiles = QFolder::listFilesInFolder($directory, false, "/\\.zip\$/i"); if (sizeof($arrFiles) > 0) { foreach ($arrFiles as $strFile) { echo "<h2>Installing " . $strFile . "</h2>"; $fullFilePath = $directory . '/' . $strFile; try { $pluginFolder = QPluginInstaller::installPluginFromZip($fullFilePath); if ($pluginFolder) { list($strStatus, $strLog) = QPluginInstaller::installFromExpanded($pluginFolder); unlink($fullFilePath); echo nl2br($strLog); } } catch (Exception $e) { echo '<div class="error">Error installing the plugin: ' . $e->getMessage() . '</div>'; } } } else { echo "<p>No plugin zip files found in the unattended install directory: " . $directory . "</p>"; echo "<p>Download new plugins from the <a target='_blank' href='" . QPluginInstaller::ONLINE_PLUGIN_REPOSITORY . "'>" . "Online repository of QCubed plugins</a></p>"; }