Skip to content

Commit

Permalink
bug #10077 Fix select attributes according to recent Symfony form cha…
Browse files Browse the repository at this point in the history
…nges (Zales0123)

This PR was merged into the 1.2 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | 1.2
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | related to symfony/symfony#29307
| License         | MIT

Due to the latest Symfony 4.1.10/3.4.21 release and changes introduced in linked PR, a bug in select attribute type araised 🌤 Apparently, possible to select values in attribute configuration was saved with `TextType` form type, even though `SelectAttributeValueTranslationsType` should be used. It was somehow parsed before, but know it's not possible and this PR fixes this absurdity 🖖 

Commits
-------

51f7ec2481d67270ed66b9879fc57702e4fafb76 Fix select attributes according to recent Symfony form changes
b80fa003a4a279c9204465b6189027db50c2285e Fix test in ResourceBundle (taken from #10062)
  • Loading branch information
pamil committed Jan 8, 2019
2 parents 5f708aa + df2b679 commit 3990c70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions test/app/config/routing.yml
Expand Up @@ -4,15 +4,15 @@ app_book:
type: sylius.resource_api

app_book_sortable_index:
path: /books/sortable/
path: /sortable-books/
methods: [GET]
defaults:
_controller: app.controller.book:indexAction
_sylius:
sortable: true

app_book_filterable_index:
path: /books/filterable/
path: /filterable-books/
methods: [GET]
defaults:
_controller: app.controller.book:indexAction
Expand All @@ -24,7 +24,7 @@ app_versioned_book:
prefix: /v{version}

app_create_book_with_custom_factory:
path: /books/create-custom
path: /create-custom-book
methods: [POST]
defaults:
_controller: app.controller.book:createAction
Expand Down
10 changes: 5 additions & 5 deletions test/src/Tests/Controller/BookApiTest.php
Expand Up @@ -161,7 +161,7 @@ public function it_does_not_apply_sorting_for_un_existing_field()
{
$this->loadFixturesFromFile('more_books.yml');

$this->client->request('GET', '/books/sortable/', ['sorting' => ['name' => 'DESC']]);
$this->client->request('GET', '/sortable-books/', ['sorting' => ['name' => 'DESC']]);
$response = $this->client->getResponse();

$this->assertResponseCode($response, Response::HTTP_OK);
Expand All @@ -174,7 +174,7 @@ public function it_does_not_apply_filtering_for_un_existing_field()
{
$this->loadFixturesFromFile('more_books.yml');

$this->client->request('GET', '/books/filterable/', ['criteria' => ['name' => 'John']]);
$this->client->request('GET', '/filterable-books/', ['criteria' => ['name' => 'John']]);
$response = $this->client->getResponse();

$this->assertResponseCode($response, Response::HTTP_OK);
Expand All @@ -187,7 +187,7 @@ public function it_applies_sorting_for_existing_field()
{
$this->loadFixturesFromFile('more_books.yml');

$this->client->request('GET', '/books/sortable/', ['sorting' => ['id' => 'DESC']]);
$this->client->request('GET', '/sortable-books/', ['sorting' => ['id' => 'DESC']]);
$response = $this->client->getResponse();

$this->assertResponseCode($response, Response::HTTP_OK);
Expand All @@ -200,7 +200,7 @@ public function it_applies_filtering_for_existing_field()
{
$this->loadFixturesFromFile('more_books.yml');

$this->client->request('GET', '/books/filterable/', ['criteria' => ['author' => 'J.R.R. Tolkien']]);
$this->client->request('GET', '/filterable-books/', ['criteria' => ['author' => 'J.R.R. Tolkien']]);
$response = $this->client->getResponse();

$this->assertResponseCode($response, Response::HTTP_OK);
Expand All @@ -223,7 +223,7 @@ public function it_allows_creating_a_book_via_custom_factory()
}
EOT;

$this->client->request('POST', '/books/create-custom', [], [], ['CONTENT_TYPE' => 'application/json'], $data);
$this->client->request('POST', '/create-custom-book', [], [], ['CONTENT_TYPE' => 'application/json'], $data);
$response = $this->client->getResponse();
$this->assertResponse($response, 'books/create_response', Response::HTTP_CREATED);
}
Expand Down

0 comments on commit 3990c70

Please sign in to comment.