-
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #91 Support for Gedmo/DoctrineExtensions (pamil)
This PR was merged into the 1.6-dev branch. Discussion ---------- Commits ------- af224ea Provide failing scenario for Gedmo/DoctrineExtensions 1851697 Add support for Gedmo DoctrineExtensions
- Loading branch information
Showing
13 changed files
with
170 additions
and
19 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AppBundle\Entity; | ||
|
||
use Sylius\Component\Resource\Model\ResourceInterface; | ||
|
||
class GedmoBaseExample implements ResourceInterface | ||
{ | ||
/** @var int */ | ||
private $id; | ||
|
||
/** @var int|null */ | ||
private $position; | ||
|
||
public function getId(): ?int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getPosition(): ?int | ||
{ | ||
return $this->position; | ||
} | ||
|
||
public function setPosition(?int $position): void | ||
{ | ||
$this->position = $position; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/Bundle/test/src/AppBundle/Entity/GedmoExtendedExample.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,30 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AppBundle\Entity; | ||
|
||
class GedmoExtendedExample extends GedmoBaseExample | ||
{ | ||
/** @var string|null */ | ||
private $extra; | ||
|
||
public function getExtra(): ?string | ||
{ | ||
return $this->extra; | ||
} | ||
|
||
public function setExtra(?string $extra): void | ||
{ | ||
$this->extra = $extra; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Bundle/test/src/AppBundle/Resources/config/doctrine/GedmoBaseExample.orm.yml
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,14 @@ | ||
AppBundle\Entity\GedmoBaseExample: | ||
type: mappedSuperclass | ||
table: gedmo | ||
id: | ||
id: | ||
type: integer | ||
id: true | ||
generator: | ||
strategy: AUTO | ||
fields: | ||
position: | ||
type: integer | ||
gedmo: | ||
- sortablePosition |
6 changes: 6 additions & 0 deletions
6
src/Bundle/test/src/AppBundle/Resources/config/doctrine/GedmoExtendedExample.orm.yml
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,6 @@ | ||
AppBundle\Entity\GedmoExtendedExample: | ||
type: mappedSuperclass | ||
table: gedmo | ||
fields: | ||
extra: | ||
type: string |
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,45 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace AppBundle\Tests\Controller; | ||
|
||
use Lakion\ApiTestCase\JsonApiTestCase; | ||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
final class GedmoApiTest extends JsonApiTestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function it_allows_creating_a_comic_book() | ||
{ | ||
$data = | ||
<<<EOT | ||
{ | ||
"extra": "Some info" | ||
} | ||
EOT; | ||
|
||
$this->client->request('POST', '/gedmos/', [], [], ['CONTENT_TYPE' => 'application/json'], $data); | ||
$response = $this->client->getResponse(); | ||
$this->assertResponse($response, 'gedmos/create_response', Response::HTTP_CREATED); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/Bundle/test/src/Tests/Responses/Expected/gedmos/create_response.json
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,5 @@ | ||
{ | ||
"id": @integer@, | ||
"position": 0, | ||
"extra": "Some info" | ||
} |