Skip to content

Commit

Permalink
Rename getRel() to getRels(), as it returns an array.
Browse files Browse the repository at this point in the history
  • Loading branch information
Crell committed Aug 14, 2016
1 parent a85a496 commit d856112
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/LinkCollectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function getLinks()
public function getLinksByRel($rel)
{
$filter = function (LinkInterface $link) use ($rel) {
return in_array($rel, $link->getRel());
return in_array($rel, $link->getRels());
};
return array_filter($this->links, $filter);
}
Expand Down
2 changes: 1 addition & 1 deletion src/LinkTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function isTemplated()
/**
* {@inheritdoc}
*/
public function getRel()
public function getRels()
{
return array_keys($this->rel);
}
Expand Down
12 changes: 6 additions & 6 deletions test/LinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function test_can_set_and_retrieve_values()
;

$this->assertEquals('http://www.google.com', $link->getHref());
$this->assertContains('next', $link->getRel());
$this->assertContains('next', $link->getRels());
$this->assertArrayHasKey('me', $link->getAttributes());
$this->assertEquals('you', $link->getAttributes()['me']);
}
Expand All @@ -33,7 +33,7 @@ public function test_can_remove_values()
->withoutRel('next');

$this->assertEquals('http://www.google.com', $link->getHref());
$this->assertFalse(in_array('next', $link->getRel()));
$this->assertFalse(in_array('next', $link->getRels()));
$this->assertFalse(array_key_exists('me', $link->getAttributes()));
}

Expand All @@ -44,16 +44,16 @@ public function test_multiple_rels()
->withRel('next')
->withRel('reference');

$this->assertCount(2, $link->getRel());
$this->assertContains('next', $link->getRel());
$this->assertContains('reference', $link->getRel());
$this->assertCount(2, $link->getRels());
$this->assertContains('next', $link->getRels());
$this->assertContains('reference', $link->getRels());
}

public function test_constructor()
{
$link = new Link('next', 'http://www.google.com');

$this->assertEquals('http://www.google.com', $link->getHref());
$this->assertContains('next', $link->getRel());
$this->assertContains('next', $link->getRels());
}
}

0 comments on commit d856112

Please sign in to comment.