protected function TestBase::assertEqual in SimpleTest 8.3
Check to see if two values are equal.
Parameters
$first: The first value to check.
$second: The second value to check.
$message: (optional) A message to display with the assertion. Do not translate messages: use \Drupal\Component\Render\FormattableMarkup 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.
15 calls to TestBase::assertEqual()
- BrowserTest::testCookieDoesNotBleed in src/
Tests/ BrowserTest.php - Tests that the cookies from a previous test do not bleed into a new test.
- BrowserTest::testCookies in src/
Tests/ BrowserTest.php - Tests that cookies set during a request are available for testing.
- BrowserTest::testGetAbsoluteUrl in src/
Tests/ BrowserTest.php - Test \Drupal\simpletest\WebTestBase::getAbsoluteUrl().
- BrowserTest::testXPathEscaping in src/
Tests/ BrowserTest.php - Tests XPath escaping.
- KernelTestBaseTest::testEnableModulesFixedList in src/
Tests/ KernelTestBaseTest.php - Tests that the module list is retained after enabling/installing/disabling.
File
- src/
TestBase.php, line 583
Class
- TestBase
- Base class for Drupal tests.
Namespace
Drupal\simpletestCode
protected function assertEqual($first, $second, $message = '', $group = 'Other') {
// Cast objects implementing MarkupInterface to string instead of
// relying on PHP casting them to string depending on what they are being
// comparing with.
$first = $this
->castSafeStrings($first);
$second = $this
->castSafeStrings($second);
$is_equal = $first == $second;
if (!$is_equal || !$message) {
$default_message = new FormattableMarkup('Value @first is equal to value @second.', [
'@first' => var_export($first, TRUE),
'@second' => var_export($second, TRUE),
]);
$message = $message ? $message . PHP_EOL . $default_message : $default_message;
}
return $this
->assert($is_equal, $message, $group);
}