From a875be9e7cc4b8f646877ce1f3027627a3e0705d Mon Sep 17 00:00:00 2001 From: Alexey Karapetov Date: Sat, 23 Feb 2019 11:56:37 -0800 Subject: [PATCH 1/7] Relationship with no "data" member. Fixed #92 --- phpunit.xml.dist | 3 +- src/EmptyRelationship.php | 31 +++++++++++++++ src/Internal/RelationshipMember.php | 11 ++++++ src/Internal/ToManyMember.php | 5 ++- src/Link/RelatedLink.php | 4 +- src/Link/SelfLink.php | 4 +- src/Meta.php | 4 +- src/ToMany.php | 6 +-- test/ResourceObjectTest.php | 59 +++++++++++++++++++++++++++++ 9 files changed, 117 insertions(+), 10 deletions(-) create mode 100644 src/EmptyRelationship.php create mode 100644 src/Internal/RelationshipMember.php diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 48bfa68..884a29a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -3,8 +3,7 @@ bootstrap="vendor/autoload.php" stopOnFailure="false" verbose="true" - colors="true" - syntaxCheck="true"> + colors="true"> ./test diff --git a/src/EmptyRelationship.php b/src/EmptyRelationship.php new file mode 100644 index 0000000..666e47d --- /dev/null +++ b/src/EmptyRelationship.php @@ -0,0 +1,31 @@ +name = $name; + $this->obj = combine($member, ...$members); + } + + /** + * @param object $o + */ + public function attachTo($o): void + { + child($o, 'relationships')->{$this->name} = $this->obj; + } +} \ No newline at end of file diff --git a/src/Internal/RelationshipMember.php b/src/Internal/RelationshipMember.php new file mode 100644 index 0000000..ca5fc49 --- /dev/null +++ b/src/Internal/RelationshipMember.php @@ -0,0 +1,11 @@ +validateFieldName($name); $this->name = $name; diff --git a/test/ResourceObjectTest.php b/test/ResourceObjectTest.php index 37e845f..540a6ea 100644 --- a/test/ResourceObjectTest.php +++ b/test/ResourceObjectTest.php @@ -4,6 +4,7 @@ use JsonApiPhp\JsonApi\Attribute; use JsonApiPhp\JsonApi\DataDocument; +use JsonApiPhp\JsonApi\EmptyRelationship; use JsonApiPhp\JsonApi\Link\RelatedLink; use JsonApiPhp\JsonApi\Link\SelfLink; use JsonApiPhp\JsonApi\Meta; @@ -13,6 +14,7 @@ use JsonApiPhp\JsonApi\ToMany; use JsonApiPhp\JsonApi\ToNull; use JsonApiPhp\JsonApi\ToOne; +use PhpCsFixer\Fixer\Casing\LowercaseKeywordsFixer; class ResourceObjectTest extends BaseTestCase { @@ -152,6 +154,63 @@ public function testRelationshipWithEmptyMultiIdLinkage() ); } + public function testRelationshipWithNoData() + { + $this->assertEncodesTo( + ' + { + "data": { + "type": "basket", + "id": "1", + "relationships": { + "empty": { + "links": { + "related": "/foo" + } + } + } + } + } + ', + new DataDocument( + new ResourceObject( + 'basket', + '1', + new EmptyRelationship('empty', new RelatedLink('/foo')) + ) + ) + ); + + $this->assertEncodesTo( + ' + { + "data": { + "type": "basket", + "id": "1", + "relationships": { + "empty": { + "links": { + "related": "/foo", + "self": "/bar" + }, + "meta": { + "foo": "bar" + } + } + } + } + } + ', + new DataDocument( + new ResourceObject( + 'basket', + '1', + new EmptyRelationship('empty', new RelatedLink('/foo'), new SelfLink('/bar'), new Meta('foo', 'bar')) + ) + ) + ); + } + public function testCanNotCreateIdAttribute() { $this->expectException(\DomainException::class); From cff881a31393eb6a923839cf91f2658062daef6e Mon Sep 17 00:00:00 2001 From: Alexey Karapetov Date: Sat, 23 Feb 2019 12:00:31 -0800 Subject: [PATCH 2/7] Add php 7.2 and 7.3 to Travis --- .travis.yml | 2 ++ src/Error.php | 2 +- src/ErrorDocument.php | 2 +- src/Included.php | 2 +- src/Internal/LinkTrait.php | 2 +- src/JsonApi.php | 2 +- src/Link/RelatedLink.php | 2 +- src/Link/SelfLink.php | 2 -- src/Meta.php | 2 -- src/ResourceIdentifier.php | 2 +- src/ResourceObject.php | 2 +- src/functions.php | 4 ++-- test/ExamplesTest.php | 4 ++-- test/ResourceObjectTest.php | 1 - test/benchmarks/compound10k.php | 2 +- 15 files changed, 15 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8ba1558..fe3c026 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ language: php php: - '7.1' + - '7.2' + - '7.3' before_script: - composer install diff --git a/src/Error.php b/src/Error.php index 35b7b8d..8e53e25 100644 --- a/src/Error.php +++ b/src/Error.php @@ -15,7 +15,7 @@ final class Error implements ErrorDocumentMember public function __construct(ErrorMember ...$members) { - $this->error = (object) []; + $this->error = (object)[]; foreach ($members as $member) { $member->attachTo($this->error); } diff --git a/src/ErrorDocument.php b/src/ErrorDocument.php index e4a52e5..dd69238 100644 --- a/src/ErrorDocument.php +++ b/src/ErrorDocument.php @@ -14,7 +14,7 @@ final class ErrorDocument implements \JsonSerializable public function __construct(Error $error, ErrorDocumentMember ...$members) { - $this->obj = (object) []; + $this->obj = (object)[]; $error->attachTo($this->obj); foreach ($members as $member) { $member->attachTo($this->obj); diff --git a/src/Included.php b/src/Included.php index 220270b..cf34e17 100644 --- a/src/Included.php +++ b/src/Included.php @@ -34,7 +34,7 @@ public function validateLinkage(PrimaryData $data): void if (isset($registry[$resource->key()]) || isset($this->identifiers[$resource->key()])) { continue; } - throw new \LogicException('Full linkage required for '.$resource); + throw new \LogicException('Full linkage required for ' . $resource); } } diff --git a/src/Internal/LinkTrait.php b/src/Internal/LinkTrait.php index 006c61a..6aeb4a1 100644 --- a/src/Internal/LinkTrait.php +++ b/src/Internal/LinkTrait.php @@ -17,7 +17,7 @@ trait LinkTrait public function __construct(string $url, Meta ...$metas) { if ($metas) { - $this->link = (object) ['href' => $url]; + $this->link = (object)['href' => $url]; foreach ($metas as $meta) { $meta->attachTo($this->link); } diff --git a/src/JsonApi.php b/src/JsonApi.php index c895bb6..8958c5d 100644 --- a/src/JsonApi.php +++ b/src/JsonApi.php @@ -12,7 +12,7 @@ final class JsonApi implements MetaDocumentMember, DataDocumentMember, ErrorDocu public function __construct(string $version = '1.0', Meta $meta = null) { - $this->obj = (object) [ + $this->obj = (object)[ 'version' => $version, ]; if ($meta) { diff --git a/src/Link/RelatedLink.php b/src/Link/RelatedLink.php index cfa3fab..f9a00e3 100644 --- a/src/Link/RelatedLink.php +++ b/src/Link/RelatedLink.php @@ -3,8 +3,8 @@ namespace JsonApiPhp\JsonApi\Link; use JsonApiPhp\JsonApi\Internal\LinkTrait; -use function JsonApiPhp\JsonApi\child; use JsonApiPhp\JsonApi\Internal\RelationshipMember; +use function JsonApiPhp\JsonApi\child; final class RelatedLink implements RelationshipMember { diff --git a/src/Link/SelfLink.php b/src/Link/SelfLink.php index b70ac65..4af9299 100644 --- a/src/Link/SelfLink.php +++ b/src/Link/SelfLink.php @@ -6,8 +6,6 @@ use JsonApiPhp\JsonApi\Internal\LinkTrait; use JsonApiPhp\JsonApi\Internal\RelationshipMember; use JsonApiPhp\JsonApi\Internal\ResourceMember; -use JsonApiPhp\JsonApi\Internal\ToManyMember; -use JsonApiPhp\JsonApi\Internal\ToOneMember; use function JsonApiPhp\JsonApi\child; final class SelfLink implements DataDocumentMember, ResourceMember, RelationshipMember diff --git a/src/Meta.php b/src/Meta.php index cb96139..5b9a2c3 100644 --- a/src/Meta.php +++ b/src/Meta.php @@ -8,8 +8,6 @@ use JsonApiPhp\JsonApi\Internal\MetaDocumentMember; use JsonApiPhp\JsonApi\Internal\RelationshipMember; use JsonApiPhp\JsonApi\Internal\ResourceMember; -use JsonApiPhp\JsonApi\Internal\ToManyMember; -use JsonApiPhp\JsonApi\Internal\ToOneMember; final class Meta implements ErrorMember, ErrorDocumentMember, MetaDocumentMember, DataDocumentMember, ResourceMember, RelationshipMember { diff --git a/src/ResourceIdentifier.php b/src/ResourceIdentifier.php index 6967856..cf1668e 100644 --- a/src/ResourceIdentifier.php +++ b/src/ResourceIdentifier.php @@ -22,7 +22,7 @@ public function __construct(string $type, string $id, Meta $meta = null) throw new \DomainException("Invalid type value: $type"); } - $this->obj = (object) [ + $this->obj = (object)[ 'type' => $type, 'id' => $id, ]; diff --git a/src/ResourceObject.php b/src/ResourceObject.php index bab4f25..a494fbd 100644 --- a/src/ResourceObject.php +++ b/src/ResourceObject.php @@ -25,7 +25,7 @@ public function __construct(string $type, string $id, ResourceMember ...$members if (isValidName($type) === false) { throw new \DomainException("Invalid type value: $type"); } - $this->obj = (object) ['type' => $type, 'id' => $id]; + $this->obj = (object)['type' => $type, 'id' => $id]; $fields = []; foreach ($members as $member) { if ($member instanceof Identifier) { diff --git a/src/functions.php b/src/functions.php index df50e2d..efd2b23 100644 --- a/src/functions.php +++ b/src/functions.php @@ -6,7 +6,7 @@ function combine(Attachable ...$members) { - $obj = (object) []; + $obj = (object)[]; foreach ($members as $member) { $member->attachTo($obj); } @@ -16,7 +16,7 @@ function combine(Attachable ...$members) function child($o, string $name) { if (!isset($o->{$name})) { - $o->{$name} = (object) []; + $o->{$name} = (object)[]; } return $o->{$name}; } diff --git a/test/ExamplesTest.php b/test/ExamplesTest.php index ba7a1cf..e9a43a8 100644 --- a/test/ExamplesTest.php +++ b/test/ExamplesTest.php @@ -19,8 +19,8 @@ public function testOutputEncodesToJson(string $file) public function examples() { return [ - [__DIR__.'/../examples/compound_doc.php'], - [__DIR__.'/../examples/simple_doc.php'], + [__DIR__ . '/../examples/compound_doc.php'], + [__DIR__ . '/../examples/simple_doc.php'], ]; } } diff --git a/test/ResourceObjectTest.php b/test/ResourceObjectTest.php index 540a6ea..3541c8d 100644 --- a/test/ResourceObjectTest.php +++ b/test/ResourceObjectTest.php @@ -14,7 +14,6 @@ use JsonApiPhp\JsonApi\ToMany; use JsonApiPhp\JsonApi\ToNull; use JsonApiPhp\JsonApi\ToOne; -use PhpCsFixer\Fixer\Casing\LowercaseKeywordsFixer; class ResourceObjectTest extends BaseTestCase { diff --git a/test/benchmarks/compound10k.php b/test/benchmarks/compound10k.php index c1a0ae2..0fc6646 100644 --- a/test/benchmarks/compound10k.php +++ b/test/benchmarks/compound10k.php @@ -28,7 +28,7 @@ use JsonApiPhp\JsonApi\ToMany; use JsonApiPhp\JsonApi\ToOne; -require_once __DIR__.'/../../vendor/autoload.php'; +require_once __DIR__ . '/../../vendor/autoload.php'; // Generate the compound document from the spec 10k times From 3ce1483dd3c4ea40070fb73f42cb1d535eae5c5b Mon Sep 17 00:00:00 2001 From: Alexey Karapetov Date: Sat, 23 Feb 2019 12:01:48 -0800 Subject: [PATCH 3/7] Style fix --- src/EmptyRelationship.php | 2 +- src/Error.php | 2 +- src/Error/SourceParameter.php | 2 +- src/Error/SourcePointer.php | 2 +- src/ErrorDocument.php | 2 +- src/Included.php | 2 +- src/Internal/LinkTrait.php | 2 +- src/Internal/RelationshipMember.php | 3 +-- src/JsonApi.php | 2 +- src/Link/AboutLink.php | 2 +- src/Link/FirstLink.php | 2 +- src/Link/LastLink.php | 2 +- src/Link/NextLink.php | 2 +- src/Link/PrevLink.php | 2 +- src/Link/RelatedLink.php | 2 +- src/Link/SelfLink.php | 2 +- src/ResourceIdentifier.php | 2 +- src/ResourceObject.php | 2 +- src/functions.php | 4 ++-- test/ExamplesTest.php | 4 ++-- test/benchmarks/compound10k.php | 2 +- 21 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/EmptyRelationship.php b/src/EmptyRelationship.php index 666e47d..1482792 100644 --- a/src/EmptyRelationship.php +++ b/src/EmptyRelationship.php @@ -28,4 +28,4 @@ public function attachTo($o): void { child($o, 'relationships')->{$this->name} = $this->obj; } -} \ No newline at end of file +} diff --git a/src/Error.php b/src/Error.php index 8e53e25..35b7b8d 100644 --- a/src/Error.php +++ b/src/Error.php @@ -15,7 +15,7 @@ final class Error implements ErrorDocumentMember public function __construct(ErrorMember ...$members) { - $this->error = (object)[]; + $this->error = (object) []; foreach ($members as $member) { $member->attachTo($this->error); } diff --git a/src/Error/SourceParameter.php b/src/Error/SourceParameter.php index 05b711a..f3bc37a 100644 --- a/src/Error/SourceParameter.php +++ b/src/Error/SourceParameter.php @@ -2,8 +2,8 @@ namespace JsonApiPhp\JsonApi\Error; -use JsonApiPhp\JsonApi\Internal\ErrorMember; use function JsonApiPhp\JsonApi\child; +use JsonApiPhp\JsonApi\Internal\ErrorMember; final class SourceParameter implements ErrorMember { diff --git a/src/Error/SourcePointer.php b/src/Error/SourcePointer.php index 84815db..0af0b5b 100644 --- a/src/Error/SourcePointer.php +++ b/src/Error/SourcePointer.php @@ -2,8 +2,8 @@ namespace JsonApiPhp\JsonApi\Error; -use JsonApiPhp\JsonApi\Internal\ErrorMember; use function JsonApiPhp\JsonApi\child; +use JsonApiPhp\JsonApi\Internal\ErrorMember; final class SourcePointer implements ErrorMember { diff --git a/src/ErrorDocument.php b/src/ErrorDocument.php index dd69238..e4a52e5 100644 --- a/src/ErrorDocument.php +++ b/src/ErrorDocument.php @@ -14,7 +14,7 @@ final class ErrorDocument implements \JsonSerializable public function __construct(Error $error, ErrorDocumentMember ...$members) { - $this->obj = (object)[]; + $this->obj = (object) []; $error->attachTo($this->obj); foreach ($members as $member) { $member->attachTo($this->obj); diff --git a/src/Included.php b/src/Included.php index cf34e17..220270b 100644 --- a/src/Included.php +++ b/src/Included.php @@ -34,7 +34,7 @@ public function validateLinkage(PrimaryData $data): void if (isset($registry[$resource->key()]) || isset($this->identifiers[$resource->key()])) { continue; } - throw new \LogicException('Full linkage required for ' . $resource); + throw new \LogicException('Full linkage required for '.$resource); } } diff --git a/src/Internal/LinkTrait.php b/src/Internal/LinkTrait.php index 6aeb4a1..006c61a 100644 --- a/src/Internal/LinkTrait.php +++ b/src/Internal/LinkTrait.php @@ -17,7 +17,7 @@ trait LinkTrait public function __construct(string $url, Meta ...$metas) { if ($metas) { - $this->link = (object)['href' => $url]; + $this->link = (object) ['href' => $url]; foreach ($metas as $meta) { $meta->attachTo($this->link); } diff --git a/src/Internal/RelationshipMember.php b/src/Internal/RelationshipMember.php index ca5fc49..3746dee 100644 --- a/src/Internal/RelationshipMember.php +++ b/src/Internal/RelationshipMember.php @@ -7,5 +7,4 @@ */ interface RelationshipMember extends ToOneMember, ToManyMember { - -} \ No newline at end of file +} diff --git a/src/JsonApi.php b/src/JsonApi.php index 8958c5d..c895bb6 100644 --- a/src/JsonApi.php +++ b/src/JsonApi.php @@ -12,7 +12,7 @@ final class JsonApi implements MetaDocumentMember, DataDocumentMember, ErrorDocu public function __construct(string $version = '1.0', Meta $meta = null) { - $this->obj = (object)[ + $this->obj = (object) [ 'version' => $version, ]; if ($meta) { diff --git a/src/Link/AboutLink.php b/src/Link/AboutLink.php index 054129e..6035330 100644 --- a/src/Link/AboutLink.php +++ b/src/Link/AboutLink.php @@ -2,9 +2,9 @@ namespace JsonApiPhp\JsonApi\Link; +use function JsonApiPhp\JsonApi\child; use JsonApiPhp\JsonApi\Internal\ErrorMember; use JsonApiPhp\JsonApi\Internal\LinkTrait; -use function JsonApiPhp\JsonApi\child; final class AboutLink implements ErrorMember { diff --git a/src/Link/FirstLink.php b/src/Link/FirstLink.php index e569e86..755a12b 100644 --- a/src/Link/FirstLink.php +++ b/src/Link/FirstLink.php @@ -2,9 +2,9 @@ namespace JsonApiPhp\JsonApi\Link; +use function JsonApiPhp\JsonApi\child; use JsonApiPhp\JsonApi\Internal\LinkTrait; use JsonApiPhp\JsonApi\Internal\PaginationLink; -use function JsonApiPhp\JsonApi\child; final class FirstLink implements PaginationLink { diff --git a/src/Link/LastLink.php b/src/Link/LastLink.php index 36a91e8..c11b2e0 100644 --- a/src/Link/LastLink.php +++ b/src/Link/LastLink.php @@ -2,9 +2,9 @@ namespace JsonApiPhp\JsonApi\Link; +use function JsonApiPhp\JsonApi\child; use JsonApiPhp\JsonApi\Internal\LinkTrait; use JsonApiPhp\JsonApi\Internal\PaginationLink; -use function JsonApiPhp\JsonApi\child; final class LastLink implements PaginationLink { diff --git a/src/Link/NextLink.php b/src/Link/NextLink.php index 1b2caa1..39f5641 100644 --- a/src/Link/NextLink.php +++ b/src/Link/NextLink.php @@ -2,9 +2,9 @@ namespace JsonApiPhp\JsonApi\Link; +use function JsonApiPhp\JsonApi\child; use JsonApiPhp\JsonApi\Internal\LinkTrait; use JsonApiPhp\JsonApi\Internal\PaginationLink; -use function JsonApiPhp\JsonApi\child; final class NextLink implements PaginationLink { diff --git a/src/Link/PrevLink.php b/src/Link/PrevLink.php index a02c69b..f38d94b 100644 --- a/src/Link/PrevLink.php +++ b/src/Link/PrevLink.php @@ -2,9 +2,9 @@ namespace JsonApiPhp\JsonApi\Link; +use function JsonApiPhp\JsonApi\child; use JsonApiPhp\JsonApi\Internal\LinkTrait; use JsonApiPhp\JsonApi\Internal\PaginationLink; -use function JsonApiPhp\JsonApi\child; final class PrevLink implements PaginationLink { diff --git a/src/Link/RelatedLink.php b/src/Link/RelatedLink.php index f9a00e3..7434423 100644 --- a/src/Link/RelatedLink.php +++ b/src/Link/RelatedLink.php @@ -2,9 +2,9 @@ namespace JsonApiPhp\JsonApi\Link; +use function JsonApiPhp\JsonApi\child; use JsonApiPhp\JsonApi\Internal\LinkTrait; use JsonApiPhp\JsonApi\Internal\RelationshipMember; -use function JsonApiPhp\JsonApi\child; final class RelatedLink implements RelationshipMember { diff --git a/src/Link/SelfLink.php b/src/Link/SelfLink.php index 4af9299..5a9a31f 100644 --- a/src/Link/SelfLink.php +++ b/src/Link/SelfLink.php @@ -2,11 +2,11 @@ namespace JsonApiPhp\JsonApi\Link; +use function JsonApiPhp\JsonApi\child; use JsonApiPhp\JsonApi\Internal\DataDocumentMember; use JsonApiPhp\JsonApi\Internal\LinkTrait; use JsonApiPhp\JsonApi\Internal\RelationshipMember; use JsonApiPhp\JsonApi\Internal\ResourceMember; -use function JsonApiPhp\JsonApi\child; final class SelfLink implements DataDocumentMember, ResourceMember, RelationshipMember { diff --git a/src/ResourceIdentifier.php b/src/ResourceIdentifier.php index cf1668e..6967856 100644 --- a/src/ResourceIdentifier.php +++ b/src/ResourceIdentifier.php @@ -22,7 +22,7 @@ public function __construct(string $type, string $id, Meta $meta = null) throw new \DomainException("Invalid type value: $type"); } - $this->obj = (object)[ + $this->obj = (object) [ 'type' => $type, 'id' => $id, ]; diff --git a/src/ResourceObject.php b/src/ResourceObject.php index a494fbd..bab4f25 100644 --- a/src/ResourceObject.php +++ b/src/ResourceObject.php @@ -25,7 +25,7 @@ public function __construct(string $type, string $id, ResourceMember ...$members if (isValidName($type) === false) { throw new \DomainException("Invalid type value: $type"); } - $this->obj = (object)['type' => $type, 'id' => $id]; + $this->obj = (object) ['type' => $type, 'id' => $id]; $fields = []; foreach ($members as $member) { if ($member instanceof Identifier) { diff --git a/src/functions.php b/src/functions.php index efd2b23..df50e2d 100644 --- a/src/functions.php +++ b/src/functions.php @@ -6,7 +6,7 @@ function combine(Attachable ...$members) { - $obj = (object)[]; + $obj = (object) []; foreach ($members as $member) { $member->attachTo($obj); } @@ -16,7 +16,7 @@ function combine(Attachable ...$members) function child($o, string $name) { if (!isset($o->{$name})) { - $o->{$name} = (object)[]; + $o->{$name} = (object) []; } return $o->{$name}; } diff --git a/test/ExamplesTest.php b/test/ExamplesTest.php index e9a43a8..ba7a1cf 100644 --- a/test/ExamplesTest.php +++ b/test/ExamplesTest.php @@ -19,8 +19,8 @@ public function testOutputEncodesToJson(string $file) public function examples() { return [ - [__DIR__ . '/../examples/compound_doc.php'], - [__DIR__ . '/../examples/simple_doc.php'], + [__DIR__.'/../examples/compound_doc.php'], + [__DIR__.'/../examples/simple_doc.php'], ]; } } diff --git a/test/benchmarks/compound10k.php b/test/benchmarks/compound10k.php index 0fc6646..c1a0ae2 100644 --- a/test/benchmarks/compound10k.php +++ b/test/benchmarks/compound10k.php @@ -28,7 +28,7 @@ use JsonApiPhp\JsonApi\ToMany; use JsonApiPhp\JsonApi\ToOne; -require_once __DIR__ . '/../../vendor/autoload.php'; +require_once __DIR__.'/../../vendor/autoload.php'; // Generate the compound document from the spec 10k times From 41bffedff8570660cc80349616e1e13418143498 Mon Sep 17 00:00:00 2001 From: Alexey Karapetov Date: Sat, 23 Feb 2019 12:05:32 -0800 Subject: [PATCH 4/7] PHPUnit deprecations fix --- test/CompoundDocumentTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/CompoundDocumentTest.php b/test/CompoundDocumentTest.php index 3d62ff9..7441200 100644 --- a/test/CompoundDocumentTest.php +++ b/test/CompoundDocumentTest.php @@ -253,11 +253,11 @@ public function testIncludedResourceMayBeIdentifiedByAnotherLinkedResource() /** * A compound document MUST NOT include more than one resource object for each type and id pair. - * @expectedException \LogicException - * @expectedExceptionMessage Resource apples:1 is already included */ public function testCanNotBeManyIncludedResourcesWithEqualIdentifiers() { + $this->expectException('LogicException'); + $this->expectExceptionMessage('Resource apples:1 is already included'); $apple = new ResourceObject('apples', '1'); new CompoundDocument($apple->identifier(), new Included($apple, $apple)); } From adb8fb8a8c9c30495bec2a662f0a604197d871b2 Mon Sep 17 00:00:00 2001 From: Alexey Karapetov Date: Sat, 23 Feb 2019 12:12:41 -0800 Subject: [PATCH 5/7] Update changelog --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86ca5ab..46030b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [2.0.2] - 2019-02-23 +### Fixed +- Relationship without data property (#92) + ## [2.0.1] - 2018-12-31 ### Changed - Downgraded min required php version to 7.1 @@ -14,5 +18,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - v2 initial release -[Unreleased]: https://github.com/json-api-php/json-api/compare/2.0.1...HEAD +[Unreleased]: https://github.com/json-api-php/json-api/compare/2.0.2...HEAD +[2.0.1]: https://github.com/json-api-php/json-api/compare/2.0.1...2.0.2 [2.0.1]: https://github.com/json-api-php/json-api/compare/2.0.0...2.0.1 From 5147444fa6a5e093f811716fd7b0a9eb81396869 Mon Sep 17 00:00:00 2001 From: Alexey Karapetov Date: Sat, 23 Feb 2019 12:12:54 -0800 Subject: [PATCH 6/7] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46030b2..ac780d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,5 +19,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - v2 initial release [Unreleased]: https://github.com/json-api-php/json-api/compare/2.0.2...HEAD -[2.0.1]: https://github.com/json-api-php/json-api/compare/2.0.1...2.0.2 +[2.0.2]: https://github.com/json-api-php/json-api/compare/2.0.1...2.0.2 [2.0.1]: https://github.com/json-api-php/json-api/compare/2.0.0...2.0.1 From b88232d79d8392b3cb815ebf2d5dc38a923ef669 Mon Sep 17 00:00:00 2001 From: Alexey Date: Mon, 25 Feb 2019 10:56:58 -0800 Subject: [PATCH 7/7] Update CHANGELOG.md --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac780d8..9185eeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] -## [2.0.2] - 2019-02-23 +## [2.1.0] - 2019-02-25 ### Fixed - Relationship without data property (#92) @@ -18,6 +18,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - v2 initial release -[Unreleased]: https://github.com/json-api-php/json-api/compare/2.0.2...HEAD -[2.0.2]: https://github.com/json-api-php/json-api/compare/2.0.1...2.0.2 +[Unreleased]: https://github.com/json-api-php/json-api/compare/2.1.0...HEAD +[2.1.0]: https://github.com/json-api-php/json-api/compare/2.0.1...2.1.0 [2.0.1]: https://github.com/json-api-php/json-api/compare/2.0.0...2.0.1 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy