You are here

protected function TestBase::assertNotEqual in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/TestBase.php \Drupal\simpletest\TestBase::assertNotEqual()

Check to see if two values are not 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\Utility\SafeMarkup::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.

66 calls to TestBase::assertNotEqual()
AccessPermissionTest::testRenderCaching in core/modules/user/src/Tests/Views/AccessPermissionTest.php
Tests access on render caching.
AccessRoleTest::testRenderCaching in core/modules/user/src/Tests/Views/AccessRoleTest.php
Tests access on render caching.
AjaxFormPageCacheTest::testSimpleAJAXFormValue in core/modules/system/src/Tests/Ajax/AjaxFormPageCacheTest.php
Create a simple form, then submit the form via AJAX to change to it.
CacheTest::testTimeResultCachingWithFilter in core/modules/views/src/Tests/Plugin/CacheTest.php
Tests result caching with filters.
ConfigEntityTest::testCRUD in core/modules/config/src/Tests/ConfigEntityTest.php
Tests CRUD operations.

... See full list

File

core/modules/simpletest/src/TestBase.php, line 711
Contains \Drupal\simpletest\TestBase.

Class

TestBase
Base class for Drupal tests.

Namespace

Drupal\simpletest

Code

protected function assertNotEqual($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);
  $not_equal = $first != $second;
  if (!$not_equal || !$message) {
    $default_message = SafeMarkup::format('Value @first is not equal to value @second.', array(
      '@first' => var_export($first, TRUE),
      '@second' => var_export($second, TRUE),
    ));
    $message = $message ? $message . PHP_EOL . $default_message : $default_message;
  }
  return $this
    ->assert($not_equal, $message, $group);
}