Checks to see if two objects are identical.
object $object1: The first object to check.
object $object2: The second object to check.
$message: (optional) A message to display with the assertion. Do not translate messages: use format_string() to embed variables in the message text, not t(). If left blank, a default message will be displayed.
$group: (optional) The group this message is in, which is displayed in a column in test output. Use 'Debug' to indicate this is debugging output. Do not translate this string. Defaults to 'Other'; most tests do not override this default.
TRUE if the assertion succeeded, FALSE otherwise.
protected function assertIdenticalObject($object1, $object2, $message = '', $group = 'Other') {
$message = $message ?: format_string('!object1 is identical to !object2', array(
'!object1' => var_export($object1, TRUE),
'!object2' => var_export($object2, TRUE),
));
$identical = TRUE;
foreach ($object1 as $key => $value) {
$identical = $identical && isset($object2->{$key}) && $object2->{$key} === $value;
}
return $this
->assertTrue($identical, $message, $group);
}