Skip to content
Snippets Groups Projects
Commit 66bdaf3d authored by The Great Git Migration's avatar The Great Git Migration
Browse files

This commit was manufactured as part of Drupal's Great Git Migration to

create tag 'DRUPAL-6--1-0'.

Sprout from DRUPAL-6--1 2008-08-28 14:31:19 UTC Doug Green <douggreen@douggreenconsulting.com> '#281399 by hailu and me - commit simpletest framework and the first few tests'
Cherrypick from master 2008-08-24 11:30:47 UTC Doug Green <douggreen@douggreenconsulting.com> 'better handling for missing files':
    tests/coder_style.test
parent 0d7ff703
No related branches found
Tags 6.x-1.0
No related merge requests found
<?php
define(CODER_OK, 1);
define(CODER_NOT_OK, 0);
class CoderStyleTest extends DrupalTestCase {
function get_info() {
return array(
'name' => t('Coder Style Tests'),
'desc' => t('Tests for the coder style review.'),
'group' => 'Coder'
);
}
function setUp() {
}
function testStyle() {
$snippets = array(
'$some_array[FOO_BAR] = $baz;' => CODER_OK,
'$some_array[foo_bar] = $baz;' => CODER_NOT_OK,
'// Tab in comment' => CODER_OK,
'$var = "tab in double quote"' => CODER_OK,
'$var = \'tab in single quote\'' => CODER_OK,
' $var = "tab in line";' => CODER_NOT_OK,
);
$reviews = coder_reviews();
foreach ($snippets as $code => $status) {
$coder_args = array(
'#severity' => SEVERITY_MINOR,
'#filename' => 'coder_style.test',
'#patch' => $code,
);
_coder_read_and_parse_file($coder_args);
$results = do_coder_review($coder_args, $reviews['style']);
if ($status == CODER_OK) {
$this->assertTrue(count($results) == 1, 'Expect NO warning: '. $code);
}
else {
$this->assertTrue(count($results) > 1, 'Expect a warning: '. $code);
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment