Added phpunit config/bootstrap files for autostart all tests

This commit is contained in:
Dmitry Khomutov 2014-03-09 01:44:54 +07:00
parent 9c6073c495
commit 7307866d24
3 changed files with 69 additions and 1 deletions

44
Tests/bootstrap.php Normal file
View file

@ -0,0 +1,44 @@
<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2013, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link http://www.phptesting.org/
*/
// Let PHP take a guess as to the default timezone, if the user hasn't set one:
date_default_timezone_set(@date_default_timezone_get());
// Set up a basic autoloader for PHPCI:
$autoload = function ($class) {
$file = str_replace(array('\\', '_'), '/', $class);
$file .= '.php';
if (substr($file, 0, 1) == '/') {
$file = substr($file, 1);
}
if (is_file(dirname(__DIR__) . '/' . $file)) {
include(dirname(__DIR__) . '/' . $file);
return;
}
};
spl_autoload_register($autoload, true, true);
// Load Composer autoloader:
require_once(dirname(__DIR__) . '/vendor/autoload.php');
// Load configuration if present:
$conf = array();
$conf['b8']['app']['namespace'] = 'PHPCI';
$conf['b8']['app']['default_controller'] = 'Home';
$conf['b8']['view']['path'] = dirname(__DIR__) . '/PHPCI/View/';
if (file_exists(dirname(__DIR__) . '/PHPCI/config.yml')) {
$config = new b8\Config($conf);
$config->loadYaml(dirname(__DIR__) . '/PHPCI/config.yml');
}
require_once(dirname(__DIR__) . '/vars.php');

View file

@ -34,11 +34,11 @@
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpspec/prophecy-phpunit": "1.*"
},
"suggest": {
"phpunit/phpunit": "PHP unit testing framework",
"phpmd/phpmd": "PHP Mess Detector",
"sebastian/phpcpd": "PHP Copy/Paste Detector",
"squizlabs/php_codesniffer": "PHP Code Sniffer",

24
phpunit.xml Normal file
View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./Tests/bootstrap.php"
>
<testsuites>
<testsuite name="PHPCI Helper Test Suite">
<directory suffix="Test.php">./Tests/PHPCI/Helper</directory>
</testsuite>
<testsuite name="PHPCI Logging Test Suite">
<directory suffix="Test.php">./Tests/PHPCI/Logging</directory>
</testsuite>
<testsuite name="PHPCI Plugin Test Suite">
<directory suffix="Test.php">./Tests/PHPCI/Plugin</directory>
</testsuite>
</testsuites>
</phpunit>