public function testLinkComparison(Link
$a, Link
$b,
$expected) { $actual = Link::
compare($a,
$b);
$this->
assertSame($expected,
$actual === 0
);
} /**
* Provides test data for link comparison.
*/
public function linkComparisonProvider() { $this->
mockUrlAssembler();
return [ 'same href and same link relation type' =>
[ new Link(new CacheableMetadata(), Url::
fromUri('https://jsonapi.org/foo'
), 'self'
),
new Link(new CacheableMetadata(), Url::
fromUri('https://jsonapi.org/foo'
), 'self'
),
TRUE,
],
'different href and same link relation type' =>
[ new Link(new CacheableMetadata(), Url::
fromUri('https://jsonapi.org/foo'
), 'self'
),
new Link(new CacheableMetadata(), Url::
fromUri('https://jsonapi.org/bar'
), 'self'
),
FALSE,
],