You are here

function CoderTestFile::test in Coder 6.2

Same name and namespace in other branches
  1. 6 scripts/coder_format/tests/CoderTestFile.php \CoderTestFile::test()
  2. 7.2 scripts/coder_format/tests/CoderTestFile.php \CoderTestFile::test()
  3. 7 scripts/coder_format/tests/CoderTestFile.php \CoderTestFile::test()

Implements SimpleExpectation::test().

Parameters

$filename Filename of test file to test.:

File

scripts/coder_format/tests/CoderTestFile.php, line 117
Set of tests for the coder_format script.

Class

CoderTestFile
Represents coder test file for full coder_format_string_all() tests.

Code

function test($filename = FALSE) {
  if ($filename) {
    $this
      ->load($filename);
  }

  // Perform test.
  // Test passes until proven invalid.
  $valid = TRUE;
  foreach ($this->input as $unit => $content) {

    // Parse input and store results.
    $this->actual[$unit] = coder_format_string_all($this->input[$unit]);

    // Let this test fail, if a unit fails.
    if ($this->expect[$unit] !== $this->actual[$unit]) {
      $valid = FALSE;
    }
  }
  return $valid;
}