PHP Classes

File: tests/all_tests.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   PHP Skeleton Framework   tests/all_tests.php   Download  
File: tests/all_tests.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Skeleton Framework
Extensive Web application development framework
Author: By
Last change:
Date: 8 years ago
Size: 1,582 bytes
 

Contents

Class file image Download
<?php
ini_set
('error_reporting', E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
ini_set('display_errors', 1);
ini_set('log_errors', 'Off');
require_once(
'config.php');
require_once(
SIMPLETESTDIR . 'simpletest.php');
require_once(
SIMPLETESTDIR . 'unit_tester.php');
require_once(
SIMPLETESTDIR . 'web_tester.php');
require_once(
SIMPLETESTDIR . 'mock_objects.php');
require_once(
SIMPLETESTDIR . 'reporter.php');

// install autoloader
require_once('../A/autoload.php');

function
add_test_files($test, $dir) {
    foreach(
glob($dir . '*') as $testfile) {
        if (
is_file($testfile) && (substr($testfile, -8) == 'Test.php')) {
           
$test->addTestFile($testfile);
        } elseif (
is_dir($testfile) && (substr($testfile, 0, 1) != '.')) {
           
add_test_files($test, $testfile . '/');
        }
    }
}

$base_dir = dirname(__FILE__) . "/unit/";
if (isset(
$_GET['test']) && file_exists($base_dir . $_GET['test'])) {
   
$testfile = $_GET['test'];
   
$title = "Test File $testfile";
} else {
   
$testfile = '';
   
$title = 'All Test Files';
}
//$test = new TestSuite($title);
$test = new GroupTest($title);
if (
$testfile) {
   
$testfile = $base_dir . $testfile;
    if (
is_file($testfile) && (substr($testfile, -8) == 'Test.php')) {
       
$test->addTestFile($testfile);
    } elseif (
is_dir($testfile) && (substr($testfile, 0, 1) != '.')) {
       
add_test_files($test, $testfile . '/');
    }
# $test->addTestFile($base_dir . $testfile);
} else {
   
add_test_files($test, $base_dir);
}
if (
TextReporter::inCli()) {
   
$test->run(new TextReporter());
} else {
   
$test->run(new HtmlReporter());
}