You are here

function CoderReviewStyleTest::testStyleStringConcatentation in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_review/tests/coder_review_style.test \CoderReviewStyleTest::testStyleStringConcatentation()

Tests for the detection of correct style of string concatenation.

File

coder_review/tests/coder_review_style.test, line 129

Class

CoderReviewStyleTest
Class to test for the style of the required Drupal coding standards.

Code

function testStyleStringConcatentation() {
  $this
    ->assertCoderReviewPass('  if ($file = file_check_upload($fieldname . "_upload")) {');
  $this
    ->assertCoderReviewFail('  if ($file = file_check_upload($fieldname ."_upload")) {');
  $this
    ->assertCoderReviewPass('  $v .= \'string\';');
  $this
    ->assertCoderReviewPass('  $a = $v . \'string\';');
  $this
    ->assertCoderReviewPass('  $a = $v . "string";');
  $this
    ->assertCoderReviewPass('  $a = "string" . $v;');
  $this
    ->assertCoderReviewPass('  $a = \'string\' . $v;');
  $this
    ->assertCoderReviewFail('  $a = "string". $v;');
  $this
    ->assertCoderReviewFail('  $a = \'string\'. $v;');
  $this
    ->assertCoderReviewFail('  $a = $v. \'string\';');
  $this
    ->assertCoderReviewFail('  $a = $v. "string";');
  $this
    ->assertCoderReviewFail('  $a = $v .\'string\';');
  $this
    ->assertCoderReviewFail('  $a = $v ."string";');
  $this
    ->assertCoderReviewFail('  $a = $v.\'string\';');
  $this
    ->assertCoderReviewFail('  $a = $v .  \'string\';');
  $this
    ->assertCoderReviewFail('  $a = $v .  "string";');
  $this
    ->assertCoderReviewFail('  $a = $v  . \'string\';');
  $this
    ->assertCoderReviewFail('  $a = $some_func(). \'string\';');
  $this
    ->assertCoderReviewPass('  $a = 1.0 * .1 * 1. * (0.1) * (1.) * (.1) * (1.0);');
}