Пример #1
0
<?php

define("APP_PATH", dirname(dirname(__FILE__)));
// initialize core
require "../vendors/THCFrame/core/core.php";
THCFrame\Core\Core::initialize();
// load different test sets
require "./_cache.php";
require "./_configuration.php";
require "./_database.php";
require "./_model.php";
require "./_template.php";
require "./_forms.php";
require "./_functions.php";
// connect to database
$database = new THCFrame\Database\Database(array("type" => "mysql", "options" => array("host" => "localhost", "username" => "root", "password" => "", "schema" => "frametest")));
$database = $database->initialize();
$database = $database->connect();
// execute tests
$results = THCFrame\Core\Test::run(function () use($database) {
    // do nothing
}, function () use($database) {
    $database->execute("DROP TABLE `tb_example`");
    $database->execute("DELETE FROM `user` WHERE `email` = \"info@tb_example.com\" AND `password` = \"password\"");
});
?>
<!DOCTYPE html>
<html>
    <head>
        <title>Unit Tests</title>
        <style type="text/css">
Пример #2
0
    error_reporting(0);
}
//check PHP version
if (version_compare(phpversion(), '5.4', '<')) {
    header('Content-type: text/html');
    include APP_PATH . '/phpversion.phtml';
    exit;
}
//xdebug profiler
//setcookie('XDEBUG_PROFILE', 1, time()+1800);
//setcookie('XDEBUG_PROFILE', '', time()-1800);
//core
require APP_PATH . '/vendors/thcframe/core/core.php';
THCFrame\Core\Core::initialize();
//plugins
$path = APP_PATH . '/application/plugins';
$iterator = new \DirectoryIterator($path);
foreach ($iterator as $item) {
    if (!$item->isDot() && $item->isDir()) {
        include $path . '/' . $item->getFilename() . '/initialize.php';
    }
}
//register modules
$modules = array('App', 'Admin');
THCFrame\Core\Core::registerModules($modules);
//internal profiler
$profiler = \THCFrame\Profiler\Profiler::getInstance();
$profiler->start();
// load services and run dispatcher
THCFrame\Core\Core::run();