Ejemplo n.º 1
0
require __DOCROOT__ . __SUBDIRECTORY__ . '/travis/qcubed.inc.php';
// Codegen for testing
// Running as a Non-Windows Command Name
$strCommandName = 'codegen.cli';
// Include the rest of the OS-agnostic script
require __DOCROOT__ . __SUBDIRECTORY__ . '/includes/_devtools/codegen.inc.php';
// not using QCubed error handler for unit tests - using the SimpleTest one instead
restore_error_handler();
require_once __QCUBED_CORE__ . '/tests/qcubed-unit/QUnitTestCaseBase.php';
require_once __QCUBED_CORE__ . '/tests/qcubed-unit/QTestControl.class.php';
class QTestForm extends QForm
{
    public $ctlTest;
    protected function Form_Create()
    {
        $this->ctlTest = new QTestControl($this);
        $this->runTests();
    }
    public function runTests()
    {
        $cliOptions = ['phpunit'];
        // first entry is the command
        array_push($cliOptions, '-c', __QCUBED_CORE__ . '/tests/phpunit.xml');
        // the config file is here
        //		array_push($cliOptions, '--bootstrap', __QCUBED_CORE__ . '/../vendor/autoload.php');
        $tester = new PHPUnit_TextUI_Command();
        $tester->run($cliOptions);
    }
}
QTestForm::Run('QTestForm', __QCUBED_CORE__ . "/tests/qcubed-unit/QTestForm.tpl.php");
Ejemplo n.º 2
0
/**
 * @var QTravisReporter 
 */
$rptReporter = null;
class QTestForm extends QForm
{
    public $ctlTest;
    protected function Form_Create()
    {
        $this->ctlTest = new QTestControl($this);
        $filesToSkip = array("QUnitTestCaseBase.php", "QTestForm.tpl.php", "QTestControl.class.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));
        }
        global $rptReporter;
        $rptReporter = new QTravisReporter();
        $suite->run($rptReporter);
    }
}
QTestForm::Run('QTestForm', __DOCROOT__ . "/travis/QTestForm.tpl.php");
// Need to return value greater then zero in a case of an error.
exit(intval($rptReporter->getFailCount() + $rptReporter->getExceptionCount()));