-
-
Notifications
You must be signed in to change notification settings - Fork 877
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5871 from soyuka/merge
Merge 3.1 into main
- Loading branch information
Showing
13 changed files
with
299 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Feature: Mercure publish support | ||
In order to publish an Update to the Mercure hub | ||
As a developer | ||
I need to specify which topics I want to send the Update on | ||
|
||
@createSchema | ||
# see https://github.com/api-platform/core/issues/5074 | ||
Scenario: Checks that Mercure Updates are dispatched properly | ||
Given I add "Accept" header equal to "application/ld+json" | ||
And I add "Content-Type" header equal to "application/ld+json" | ||
When I send a "POST" request to "/issue5074/mercure_with_topics" with body: | ||
""" | ||
{ | ||
"name": "Hello World!", | ||
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit." | ||
} | ||
""" | ||
Then the response status code should be 201 | ||
And the response should be in JSON | ||
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8" | ||
Then 1 Mercure update should have been sent | ||
And the Mercure update should have topics: | ||
| http://example.com/issue5074/mercure_with_topics/1 | | ||
And the Mercure update should have data: | ||
""" | ||
{ | ||
"@context": "/contexts/MercureWithTopics", | ||
"@id": "/issue5074/mercure_with_topics/1", | ||
"@type": "MercureWithTopics", | ||
"id": 1, | ||
"name": "Hello World!" | ||
} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
tests/Fixtures/TestBundle/Document/Issue5074/MercureWithTopics.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\Tests\Fixtures\TestBundle\Document\Issue5074; | ||
|
||
use ApiPlatform\Metadata\ApiResource; | ||
use ApiPlatform\Metadata\Get; | ||
use ApiPlatform\Metadata\Post; | ||
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; | ||
|
||
#[ApiResource( | ||
operations: [ | ||
new Get(uriTemplate: '/issue5074/mercure_with_topics/{id}{._format}'), | ||
new Post(uriTemplate: '/issue5074/mercure_with_topics{._format}'), | ||
], | ||
mercure: ['topics' => '@=iri(object)'], | ||
extraProperties: ['standard_put' => false] | ||
)] | ||
#[ODM\Document] | ||
class MercureWithTopics | ||
{ | ||
#[ODM\Id(strategy: 'INCREMENT', type: 'int')] | ||
public $id; | ||
#[ODM\Field(type: 'string')] | ||
public $name; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
tests/Fixtures/TestBundle/Entity/Issue5074/MercureWithTopics.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\Tests\Fixtures\TestBundle\Entity\Issue5074; | ||
|
||
use ApiPlatform\Metadata\ApiResource; | ||
use ApiPlatform\Metadata\Get; | ||
use ApiPlatform\Metadata\Post; | ||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
#[ApiResource( | ||
operations: [ | ||
new Get(uriTemplate: '/issue5074/mercure_with_topics/{id}{._format}'), | ||
new Post(uriTemplate: '/issue5074/mercure_with_topics{._format}'), | ||
], | ||
mercure: ['topics' => '@=iri(object)'], | ||
extraProperties: ['standard_put' => false] | ||
)] | ||
#[ORM\Entity] | ||
class MercureWithTopics | ||
{ | ||
#[ORM\Id] | ||
#[ORM\Column(type: 'integer')] | ||
#[ORM\GeneratedValue(strategy: 'AUTO')] | ||
public $id; | ||
#[ORM\Column] | ||
public $name; | ||
} |
Oops, something went wrong.