protected function StorageTestBase::assertIdenticalObject in Service Container 7
Same name and namespace in other branches
- 7.2 lib/Drupal/service_container/Tests/KeyValue/StorageTestBase.php \Drupal\service_container\Tests\KeyValue\StorageTestBase::assertIdenticalObject()
Checks to see if two objects are identical.
Parameters
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 \Drupal\Component\Utility\String::format() 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.
Return value
TRUE if the assertion succeeded, FALSE otherwise.
3 calls to StorageTestBase::assertIdenticalObject()
- DatabaseStorageExpirableTest::_testCRUDWithExpiration in lib/
Drupal/ service_container/ Tests/ KeyValue/ DatabaseStorageExpirableTest.php - Tests CRUD functionality with expiration.
- StorageTestBase::_testCRUD in lib/
Drupal/ service_container/ Tests/ KeyValue/ StorageTestBase.php - Tests CRUD operations.
- StorageTestBase::_testSetIfNotExists in lib/
Drupal/ service_container/ Tests/ KeyValue/ StorageTestBase.php - Tests the setIfNotExists() method.
File
- lib/
Drupal/ service_container/ Tests/ KeyValue/ StorageTestBase.php, line 99 - Contains Drupal\service_container\Tests\KeyValue\StorageTestBase.
Class
- StorageTestBase
- Base class for testing key-value storages.
Namespace
Drupal\service_container\Tests\KeyValueCode
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);
}