コード例 #1
0
<?php

// $Id$
if (!defined('TEST')) {
    define('TEST', __FILE__);
}
require_once dirname(__FILE__) . '/test_groups.php';
require_once dirname(__FILE__) . '/../reporter.php';
if (TEST == __FILE__) {
    $test = new UnitTests();
    if (SimpleReporter::inCli()) {
        exit($test->run(new TextReporter()) ? 0 : 1);
    }
    $test->run(new HtmlReporter());
}
コード例 #2
0
ファイル: UnitTests.php プロジェクト: Bemmu/php-myspace-api
        return UnitTests::common_authorization_header_test(array('blah' => 'blah'), 'WXkYJlgVUAe3tJ0CAIXoSIywGio%3D');
    }
    static function test_appdata_authorization_header_multi_param()
    {
        return UnitTests::common_authorization_header_test(array('blah' => 'blah', 'kissa' => 'koira'), 'MQtaEwNV8gfz%2Fs%2F96wkwm5VknFA%3D');
    }
    static function run()
    {
        $all_succeeded = TRUE;
        foreach (get_class_methods('UnitTests') as $method) {
            if (strpos($method, 'test_') === 0) {
                echo $method . ' -- ';
                $success = call_user_func('UnitTests::' . $method);
                $text = $success ? 'PASS' : 'FAIL';
                $color = $success ? 32 : 31;
                echo chr(27) . "[01;{$color} m{$text}" . chr(27) . '[00m';
                if (!$success) {
                    $all_succeeded = FALSE;
                }
                echo "\n";
            }
        }
        if (!$all_succeeded) {
            echo "\n**** SOME TESTS FAILED ****\n";
            exit(1);
        }
        exit(0);
    }
}
UnitTests::run();