| 1 |
<?php
|
| 2 |
// $Id: all.test,v 1.3 2009/03/06 17:05:41 snpower Exp $
|
| 3 |
|
| 4 |
// Load PEAR Text_Diff library.
|
| 5 |
set_include_path(get_include_path() . PATH_SEPARATOR . drupal_get_path('module', 'coder') .'/scripts/coder_format/tests');
|
| 6 |
|
| 7 |
// FIXME: Sloppy workaround for avoiding fatal errors; skip the rest of this
|
| 8 |
// file if this folder doesn't exist.
|
| 9 |
if (is_dir('Text/Diff')) {
|
| 10 |
include_once 'Text/Diff.php';
|
| 11 |
include_once 'Text/Diff/Renderer.php';
|
| 12 |
|
| 13 |
// Load coder_format test cases.
|
| 14 |
include_once 'CoderTestCase.php';
|
| 15 |
include_once 'CoderTestFile.php';
|
| 16 |
|
| 17 |
/**
|
| 18 |
* Coder Format tests.
|
| 19 |
*/
|
| 20 |
class CoderFormatTest extends CoderReviewTestCase {
|
| 21 |
public static function getInfo() {
|
| 22 |
return array(
|
| 23 |
'name' => 'Full coder_format tests',
|
| 24 |
'description' => t('Tests all of the functionality of the coder_format script.'),
|
| 25 |
'group' => 'Coder Format Tests',
|
| 26 |
);
|
| 27 |
}
|
| 28 |
|
| 29 |
function test() {
|
| 30 |
$dir = drupal_get_path('module', 'coder') .'/scripts/coder_format/tests/tests';
|
| 31 |
$files = array_keys(file_scan_directory($dir, '\.phpt$'));
|
| 32 |
// Order tests alphabetically, but use a weight > 0 to append them after
|
| 33 |
// overall test results.
|
| 34 |
$c = 10;
|
| 35 |
foreach ($files as $file) {
|
| 36 |
$expectation = new CoderReviewTestFile();
|
| 37 |
$result = $this->assert($expectation, $file, '%s');
|
| 38 |
if (!$result) {
|
| 39 |
$this->_reporter->writeContent($expectation->render(), $c++);
|
| 40 |
}
|
| 41 |
}
|
| 42 |
}
|
| 43 |
}
|
| 44 |
|
| 45 |
}
|