You are here

function SimpleTestFunctionalTest::assertAssertion in Drupal 7

Assert that an assertion with the specified values is displayed in the test results.

Parameters

string $message Assertion message.:

string $type Assertion type.:

string $status Assertion status.:

string $file File where the assertion originated.:

string $functuion Function where the assertion originated.:

Return value

Assertion result.

1 call to SimpleTestFunctionalTest::assertAssertion()
SimpleTestFunctionalTest::confirmStubTestResults in modules/simpletest/simpletest.test
Confirm that the stub test produced the desired results.

File

modules/simpletest/simpletest.test, line 244
Tests for simpletest.module.

Class

SimpleTestFunctionalTest
@file Tests for simpletest.module.

Code

function assertAssertion($message, $type, $status, $file, $function) {
  $message = trim(strip_tags($message));
  $found = FALSE;
  foreach ($this->childTestResults['assertions'] as $assertion) {
    if (strpos($assertion['message'], $message) !== FALSE && $assertion['type'] == $type && $assertion['status'] == $status && $assertion['file'] == $file && $assertion['function'] == $function) {
      $found = TRUE;
      break;
    }
  }
  return $this
    ->assertTrue($found, format_string('Found assertion {"@message", "@type", "@status", "@file", "@function"}.', array(
    '@message' => $message,
    '@type' => $type,
    '@status' => $status,
    "@file" => $file,
    "@function" => $function,
  )));
}