function TestBaseTest::providerEqualityAssertions

Data provider for tests of equality assertions.

Used by testAssertIdentical(), testAssertEqual(), testAssertNotIdentical(), and testAssertNotEqual().

Return value

Array of test data.

  • Expected assertion value for identical comparison.
  • Expected assertion value for equal comparison.
  • First value to compare.
  • Second value to compare.

File

core/modules/simpletest/tests/src/Unit/TestBaseTest.php, line 292

Class

TestBaseTest
@requires extension curl @coversDefaultClass \Drupal\simpletest\TestBase @group simpletest @group TestBase

Namespace

Drupal\Tests\simpletest\Unit

Code

public function providerEqualityAssertions() {
    return [
        // Integers and floats.
[
            TRUE,
            TRUE,
            0,
            0,
        ],
        [
            FALSE,
            TRUE,
            0,
            0.0,
        ],
        [
            FALSE,
            TRUE,
            '0',
            0,
        ],
        [
            FALSE,
            TRUE,
            '0.0',
            0.0,
        ],
        [
            FALSE,
            FALSE,
            23,
            77,
        ],
        [
            TRUE,
            TRUE,
            23.0,
            23.0,
        ],
        // Strings.
[
            FALSE,
            FALSE,
            'foof',
            'yay',
        ],
        [
            TRUE,
            TRUE,
            'yay',
            'yay',
        ],
        // Bools with type conversion.
[
            TRUE,
            TRUE,
            TRUE,
            TRUE,
        ],
        [
            TRUE,
            TRUE,
            FALSE,
            FALSE,
        ],
        [
            FALSE,
            TRUE,
            NULL,
            FALSE,
        ],
        [
            FALSE,
            TRUE,
            'TRUE',
            TRUE,
        ],
        [
            FALSE,
            FALSE,
            'FALSE',
            FALSE,
        ],
        [
            FALSE,
            TRUE,
            0,
            FALSE,
        ],
        [
            FALSE,
            TRUE,
            1,
            TRUE,
        ],
        [
            FALSE,
            TRUE,
            -1,
            TRUE,
        ],
        [
            FALSE,
            TRUE,
            '1',
            TRUE,
        ],
        [
            FALSE,
            TRUE,
            '1.3',
            TRUE,
        ],
        // Null.
[
            FALSE,
            FALSE,
            'NULL',
            NULL,
        ],
        [
            TRUE,
            TRUE,
            NULL,
            NULL,
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.