You are here

function DrupalTestCase::assertReference in SimpleTest 5

Same name and namespace in other branches
  1. 6 drupal_test_case.php \DrupalTestCase::assertReference()

Will trigger a pass if both parameters refer to the same object. Fail otherwise.

Parameters

mixed $first Object reference to check.: @param mixed $second Hopefully the same object. @param string $message Message to display. @return boolean True on pass @access public

File

./drupal_test_case.php, line 565

Class

DrupalTestCase
Test case for typical Drupal tests. Extends WebTestCase for comfortable browser usage but also implements all UnitTestCase methods, I wish WebTestCase would do this.

Code

function assertReference(&$first, &$second, $message = "%s") {
  $dumper =& new SimpleDumper();
  $message = sprintf($message, "[" . $dumper
    ->describeValue($first) . "] and [" . $dumper
    ->describeValue($second) . "] should reference the same object");
  return $this
    ->assertTrue(SimpleTestCompatibility::isReference($first, $second), $message);
}