Skip to content

Commit

Permalink
Get tests running.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Convissor committed Jan 1, 2012
1 parent dde5ae5 commit 3ec089b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 34 deletions.
13 changes: 7 additions & 6 deletions tests/AllTests.php
Expand Up @@ -47,16 +47,15 @@
}

require_once dirname(__FILE__) . '/helper.inc';
require_once dirname(__FILE__) . '/DocBlockGeneratorTest.php';

/**
* DocBlock Generator Test suite
*
* Run the tests from the tests directory.
* #phpunit PHP_DocBlockGenerator_AllTests AllTests.php
* Run the tests from the directory above the "tests" directory.
* # phpunit -d error_reporting=22527 tests
*
* To run the code coverage test, 2 steps:
* #phpunit --report reports/coverage PHP_DocBlockGenerator_AllTests AllTests.php
* #phpunit -d error_reporting=22527 --report reports/coverage tests
* browse the results in index.html file in reports/coverage
*
* The code coverage is close to 100%.
Expand Down Expand Up @@ -92,9 +91,11 @@ public static function main()
*/
public static function suite()
{
$dir = dirname(__FILE__);
$suite = new PHPUnit_Framework_TestSuite('PHP_DocBlockGenerator Tests');
$suite->addTestFile("$dir/DocBlockGeneratorTest.php");

$dir = new GlobIterator(dirname(__FILE__) . '/*Test.php');
$suite->addTestFiles($dir);

return $suite;
}
}
Expand Down
28 changes: 0 additions & 28 deletions tests/DocBlockGeneratorTest.php
Expand Up @@ -35,21 +35,9 @@
* @link http://pear.php.net/package/PHP_DocBlockGenerator
*/

// Keep tests from running twice when calling this file directly via PHPUnit.
$call_main = false;
if (strpos($_SERVER['argv'][0], 'phpunit') === false) {
// Called via php, not PHPUnit. Pass the request to PHPUnit.
if (!defined('PHPUnit_MAIN_METHOD')) {
/** The test's main method name */
define('PHPUnit_MAIN_METHOD', 'tests_DocBlockGeneratorTest::main');
$call_main = true;
}
}

require_once dirname(__FILE__) . '/helper.inc';

require_once "PHPUnit/Framework/TestCase.php";
require_once "PHPUnit/Framework/TestSuite.php";

require_once 'PHP/DocBlockGenerator.php';

Expand All @@ -75,18 +63,6 @@ class tests_DocBlockGeneratorTest extends PHPUnit_Framework_TestCase
*/
private $docBlockGen;

/**
* Runs the test methods of this class.
*
* @access public
* @static
*/
public static function main()
{
$suite = new PHPUnit_Framework_TestSuite("PHP_DocBlockGeneratorTest");
$result = PHPUnit_TextUI_TestRunner::run($suite);
}

/**
* Sets up the fixture, for example, open a network connection.
* This method is called before a test is executed.
Expand Down Expand Up @@ -219,7 +195,3 @@ private function genDocBlockTest($fileName, $param = array())
return true;
}
}

if ($call_main) {
tests_DocBlockGeneratorTest::main();
}

0 comments on commit 3ec089b

Please sign in to comment.