1 simpletest.test SimpleTestFunctionalTest::assertAssertion($message, $type, $status, $file, $function)

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 $function: Function where the assertion originated.

Return value

boolean: TRUE if the assertion is displayed, FALSE if it is not.

File

core/modules/simpletest/tests/simpletest.test, line 266
Tests for simpletest.module.

Class

SimpleTestFunctionalTest

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)));
}