Skip to content

Commit

Permalink
Merge pull request #8 from f3ath/development
Browse files Browse the repository at this point in the history
PSR-12
  • Loading branch information
f3ath authored Mar 28, 2017
2 parents 4f1a7ef + 3c8e445 commit 460435c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: php
php:
- '7.0'
- '7.1'
- hhvm
- nightly

before_script:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $author = Relationship::fromLinkage(
$author->setLink('self', '/articles/1/relationships/author');
$author->setLink('related', '/articles/1/author');

$articles = new Resource('articles', '1');
$articles = new ResourceObject('articles', '1');
$articles->setRelationship('author', $author);
$articles->setAttribute('title', 'Rails is Omakase');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use JsonApiPhp\JsonApi\Document\Resource\Relationship\Relationship;
use JsonApiPhp\JsonApi\HasLinksAndMeta;

final class Resource implements PrimaryData, PrimaryDataItem
final class ResourceObject implements PrimaryData, PrimaryDataItem
{
use HasLinksAndMeta;

Expand Down
10 changes: 5 additions & 5 deletions test/Document/Resource/ResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace JsonApiPhp\JsonApi\Test\Document\Resource;

use JsonApiPhp\JsonApi\Document\Resource\Relationship\Relationship;
use JsonApiPhp\JsonApi\Document\Resource\Resource;
use JsonApiPhp\JsonApi\Document\Resource\ResourceObject;
use JsonApiPhp\JsonApi\Document\Resource\ResourceId;
use JsonApiPhp\JsonApi\Test\HasAssertEqualsAsJson;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -71,7 +71,7 @@ public function resourceProvider()
],
],
(function () {
$resource = new Resource('books', '42abc');
$resource = new ResourceObject('books', '42abc');
$resource->setMeta('foo', 'bar');
$resource->setAttribute('attr', 'val');
$resource->setLink('self', 'http://localhost');
Expand All @@ -90,7 +90,7 @@ public function resourceProvider()
*/
public function testAttributeCanNotHaveReservedNames(string $name)
{
$r = new Resource('books', 'abc');
$r = new ResourceObject('books', 'abc');
$r->setAttribute($name, 1);
}

Expand All @@ -108,7 +108,7 @@ public function invalidAttributeNames(): array
*/
public function testCanNotSetRelationshipIfAttributeExists()
{
$res = new Resource('books', '1');
$res = new ResourceObject('books', '1');
$res->setAttribute('foo', 'bar');
$res->setRelationship('foo', Relationship::fromMeta(['a' => 'b']));
}
Expand All @@ -119,7 +119,7 @@ public function testCanNotSetRelationshipIfAttributeExists()
*/
public function testCanNotSetAttributeIfRelationshipExists()
{
$res = new Resource('books', '1');
$res = new ResourceObject('books', '1');
$res->setRelationship('foo', Relationship::fromMeta(['a' => 'b']));
$res->setAttribute('foo', 'bar');
}
Expand Down
5 changes: 3 additions & 2 deletions test/IntegrationTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php
declare(strict_types=1);

namespace JsonApiPhp\JsonApi\Test;

use JsonApiPhp\JsonApi\Document\Document;
use JsonApiPhp\JsonApi\Document\Resource\Relationship\Linkage;
use JsonApiPhp\JsonApi\Document\Resource\Relationship\Relationship;
use JsonApiPhp\JsonApi\Document\Resource\Resource;
use JsonApiPhp\JsonApi\Document\Resource\ResourceObject;
use JsonApiPhp\JsonApi\Document\Resource\ResourceId;
use PHPUnit\Framework\TestCase;

Expand Down Expand Up @@ -37,7 +38,7 @@ public function testFromTheReadmeFile()
}
JSON;

$articles = new Resource('articles', '1');
$articles = new ResourceObject('articles', '1');
$author = Relationship::fromLinkage(
Linkage::fromSingleResourceId(
new ResourceId('people', '9')
Expand Down

0 comments on commit 460435c

Please sign in to comment.