Skip to content

Commit

Permalink
Merge pull request #68 from piotrbelina/feature/fix-invalid-resource-…
Browse files Browse the repository at this point in the history
…id-2.0

Fixed invalid resource id
  • Loading branch information
kocsismate authored Jan 31, 2018
2 parents 7bf6a6e + a320d17 commit 003025e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/JsonApi/Exception/ResourceIdInvalid.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ResourceIdInvalid extends JsonApiException
*/
protected $id;

public function __construct(string $id)
public function __construct($id)
{
parent::__construct("The resource ID '$id' must be a string!");
$this->id = $id;
Expand Down
13 changes: 12 additions & 1 deletion tests/JsonApi/Exception/ResourceIdInvalidTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@ public function getId()
$this->assertEquals($id, $exception->getId());
}

private function createException(string $id): ResourceIdInvalid
/**
* @test
*/
public function createExceptionForNotString()
{
$id = 1;

$exception = $this->createException($id);
$this->assertEquals($id, $exception->getId());
}

private function createException($id): ResourceIdInvalid
{
return new ResourceIdInvalid($id);
}
Expand Down

0 comments on commit 003025e

Please sign in to comment.