Subversion Repositories Applications.framework

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 aurelien 1
<?php
2
/**
3
 * A test class for running all PHP_CodeSniffer unit tests.
4
 *
5
 * PHP version 5
6
 *
7
 * @category  PHP
8
 * @package   PHP_CodeSniffer
9
 * @author    Greg Sherwood <gsherwood@squiz.net>
10
 * @author    Marc McIntyre <mmcintyre@squiz.net>
11
 * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
12
 * @license   http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
13
 * @version   CVS: $Id: AllTests.php,v 1.6 2007/08/15 01:27:30 squiz Exp $
14
 * @link      http://pear.php.net/package/PHP_CodeSniffer
15
 */
16
 
17
if (!defined('PHPUnit_MAIN_METHOD')) {
18
    define('PHPUnit_MAIN_METHOD', 'PHP_CodeSniffer_AllTests::main');
19
}
20
 
21
require_once 'TestSuite.php';
22
require_once 'PHPUnit/TextUI/TestRunner.php';
23
 
24
if (is_file(dirname(__FILE__).'/../CodeSniffer.php') === true) {
25
    // We are not installed.
26
    include_once 'Core/AllTests.php';
27
    include_once 'Standards/AllSniffs.php';
28
    include_once dirname(__FILE__).'/../CodeSniffer.php';
29
} else {
30
    include_once 'CodeSniffer/Core/AllTests.php';
31
    include_once 'CodeSniffer/Standards/AllSniffs.php';
32
    include_once 'PHP/CodeSniffer.php';
33
}
34
 
35
/**
36
 * A test class for running all PHP_CodeSniffer unit tests.
37
 *
38
 * Usage: phpunit AllTests.php
39
 *
40
 * @category  PHP
41
 * @package   PHP_CodeSniffer
42
 * @author    Greg Sherwood <gsherwood@squiz.net>
43
 * @author    Marc McIntyre <mmcintyre@squiz.net>
44
 * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
45
 * @license   http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
46
 * @version   Release: 1.2.0RC1
47
 * @link      http://pear.php.net/package/PHP_CodeSniffer
48
 */
49
class PHP_CodeSniffer_AllTests
50
{
51
 
52
 
53
    /**
54
     * Prepare the test runner.
55
     *
56
     * @return void
57
     */
58
    public static function main()
59
    {
60
        PHPUnit_TextUI_TestRunner::run(self::suite());
61
 
62
    }//end main()
63
 
64
 
65
    /**
66
     * Add all PHP_CodeSniffer test suites into a single test suite.
67
     *
68
     * @return PHPUnit_Framework_TestSuite
69
     */
70
    public static function suite()
71
    {
72
        // Use a special PHP_CodeSniffer test suite so that we can
73
        // unset our autoload function after the run.
74
        $suite = new PHP_CodeSniffer_TestSuite('PHP CodeSniffer');
75
 
76
        $suite->addTest(PHP_CodeSniffer_Core_AllTests::suite());
77
        $suite->addTest(PHP_CodeSniffer_Standards_AllSniffs::suite());
78
 
79
        // Unregister this here because the PEAR tester loads
80
        // all package suites before running then, so our autoloader
81
        // will cause problems for the packages included after us.
82
        spl_autoload_unregister(array('PHP_CodeSniffer', 'autoload'));
83
 
84
        return $suite;
85
 
86
    }//end suite()
87
 
88
 
89
}//end class
90
 
91
?>