function LinkTest::testLinkComparison
Tests link comparison.
@legacy-covers ::compare
Attributes
#[DataProvider('linkComparisonProvider')]
File
-
core/
modules/ jsonapi/ tests/ src/ Unit/ JsonApiResource/ LinkTest.php, line 32
Class
Namespace
Drupal\Tests\jsonapi\Unit\JsonApiResourceCode
public function testLinkComparison(array $a, array $b, bool $expected) : void {
$this->mockUrlAssembler();
$link_a = new Link(new CacheableMetadata(), Url::fromUri($a[0]), $a[1], $a[2] ?? []);
$link_b = new Link(new CacheableMetadata(), Url::fromUri($b[0]), $b[1], $b[2] ?? []);
$actual = Link::compare($link_a, $link_b);
$this->assertSame($expected, $actual === 0);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.