function MarkupInterfaceComparatorTest::testDeprecatedAssertEquals

@covers ::assertEquals @dataProvider dataSetProviderDeprecatedCases @group legacy

File

core/tests/Drupal/KernelTests/Core/Test/Comparator/MarkupInterfaceComparatorTest.php, line 237

Class

MarkupInterfaceComparatorTest
Tests \Drupal\TestTools\Comparator\MarkupInterfaceComparator.

Namespace

Drupal\KernelTests\Core\Test\Comparator

Code

public function testDeprecatedAssertEquals($expected, $actual, bool $accepts_result, $equals_result, string $deprecation_message) : void {
    if ($accepts_result) {
        $this->assertTrue($this->comparator
            ->accepts($expected, $actual));
    }
    else {
        $this->assertFalse($this->comparator
            ->accepts($expected, $actual));
    }
    if ($deprecation_message) {
        $this->expectDeprecation($deprecation_message);
    }
    try {
        $this->assertNull($this->comparator
            ->assertEquals($expected, $actual));
        $this->assertTrue($equals_result);
    } catch (\Throwable $e) {
        if ($equals_result === FALSE) {
            $this->assertNotNull($e->getMessage());
        }
        else {
            $this->assertInstanceOf($equals_result, $e);
        }
    }
}

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