-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Tests for EntityType field with multiple=true #23930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This PR was submitted for the master branch but it was merged into the 2.8 branch instead (closes #21645). Discussion ---------- Minor typo fix messsagesData -> messagesData | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT Commits ------- 7efb4f0 Minor typo fix messsagesData -> messagesData
* 2.7: Update to PHPUnit namespaces remove translation data collector when not usable
* 2.7: move conflict section of composer.json
* 2.7: minor fix purge both http and https from http cache store
* 2.7: fixed Composer constraints
…(nicolas-grekas, GuilhemN) This PR was merged into the 2.8 branch. Discussion ---------- [DependencyInjection] Fix autowiring collisions detection | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | Fixes #21658 by implementing the second proposal of #21658 (comment): > Another idea: store the types used previously and check that new services registered don't implement them. Commits ------- bb70472 [DependencyInjection] Fix autowiring collisions detection 6f578ee [DI] Bug in autowiring collisions detection
…more than 2 services colliding (GuilhemN) This PR was merged into the 2.8 branch. Discussion ---------- [DependencyInjection] Fix autowiring types when there are more than 2 services colliding | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | There is a bug in the `AutowirePass`, when using more than 2 services colliding and you want to use the autowiring types: it may not work depending on their order because `notGuessableTypes` is not reset. Commits ------- 5981278 [DependencyInjection] Fix using autowiring types when there are more than 2 services
* 2.7: [Serializer] Removed duplicate operation in camelcase denormalization [Validator] do not guess getter method names
This PR was squashed before being merged into the 2.8 branch (closes #21663). Discussion ---------- Updated PHPUnit namespaces | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Follow Up of #21564 Commits ------- 205ced4 Updated PHPUnit namespaces
* 2.7: Add missing conflict rules for phpunit
* 2.7: Further refactorings to PHPUnit namespaces resolve parameters in definition classes
…paced PHPUnit 6 (peterrehm) This PR was merged into the 2.8 branch. Discussion ---------- Refactored other PHPUnit method calls to work with namespaced PHPUnit 6 | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | - | License | MIT | Doc PR | - Continued work to make Symfony PHPUnit 6 compatible. Commits ------- dbe8898 Refactored other PHPUnit method calls to work with namespaced PHPUnit 6
* 2.7: Use PHPUnit 6.0 on PHP 7.* test lines
* 2.7: fix priority ordering of security voters
* 2.7: Revamped the README file Fix missing namespace in AddConstraintValidatorPassTest [ExpressionLanguage] Registering functions after calling evaluate(), compile() or parse() is not supported
This PR was merged into the 2.8 branch. Discussion ---------- [WebServerBundle] fixed html attribute escape | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - In the Web Debug Toolbar, when a toolbar item has extra attributes, they are not properly escaped. (If you put your mouse over the right toolbar item with sf version, you will see a tooltip with `""`) Currently: ```html title="" ``` After: ```html title="" ``` Commits ------- 1337cdb [WebServerBundle] fixed html attribute escape
If the listener is already configured through the PHPUnit config, there is no need to also enable it explicitly in the test runner.
…abbuh) This PR was merged into the 2.8 branch. Discussion ---------- [PhpUnitBridge] do not register the test listener twice | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | If the listener is already configured through the PHPUnit config, there is no need to also enable it explicitly in the test runner. Commits ------- cee435f do not register the test listener twice
* 2.7: [SecurityBundle] only pass relevant user provider [Intl] Make tests pass after the ICU data update [Intl] Update ICU data to 58.2 [DependencyInjection] removed dead code. [Yaml] Stop replacing NULLs when merging
* 2.7: Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)" [DependencyInjection] inline conditional statements.
* 2.7: [2.7] Fix issues reported by static analyse [Serializer] Reduce nesting in YamlFileLoader
* 2.7: [Bridge\ProxyManager] Dont call __destruct() on non-instantiated services bumped Symfony version to 2.7.34 updated VERSION for 2.7.33 update CONTRIBUTORS for 2.7.33 updated CHANGELOG for 2.7.33
* 2.7: Github template: Remove EOM 3.2 from branch suggestion [Security] Fix security.interactive_login event const doc block Avoid infinite loops when profiler data is malformed [HttpFoundation] Generate safe fallback filename for wrongly encoded filename
* 2.7: [DI] Fix some docblocks
… (sampart) This PR was squashed before being merged into the 2.8 branch (closes #23826). Discussion ---------- [2.8] Modify 2.8 upgrade doc - key option is deprecated. | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no, but this is only a documentation change - I don't think it's my change that has broken them. | Fixed tickets | n/a | License | MIT | Doc PR | n/a The 2.8.0 section of the [CHANGELOG for the Security bundle](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md#280) has two items in it > * deprecated the `key` setting of `anonymous`, `remember_me` and `http_digest` in favor of the `secret` setting. > * deprecated the `intention` firewall listener setting in favor of the `csrf_token_id`. The first of these isn't also in the Symfony upgrade guide, but the second is. This PR adds the missing item (deprecated `key` setting) into the Symfony upgrade guide. Commits ------- 2309fd9 [2.8] Modify 2.8 upgrade doc - key option is deprecated.
* 2.7: [DebugBundle] Reword an outdated comment about var dumper wiring Ignore memcached missing key error on dession destroy
* 2.7: [DI] Fix dumping abstract with YamlDumper
* 2.7: Update JsonBundleReader.php [HttpKernel] Clean test directory on tear down Fix testHtml method with regexp
Added some tests for #23927
$form->setData($emptyArray); | ||
$form->submit(null); | ||
|
||
$this->assertInternalType('array', $form->getData()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial & expected data should be an ArrayCollection()
for both cases, see other tests
symfony/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
Lines 416 to 422 in 1732cc8
$existing = new ArrayCollection(array(0 => $entity2)); | |
$field->setData($existing); | |
$field->submit(array('1', '3')); | |
// entry with index 0 ($entity2) was replaced | |
$expected = new ArrayCollection(array(0 => $entity1, 1 => $entity3)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yceruto I think there is also a documentation issue here because it's said that returned value is an array
http://symfony.com/doc/current/reference/forms/types/entity.html#multiple
Btw I'll change tests tomorrow (Edit: I didn't see #23927 (comment), so I won't change tests if I understood)
I committed the fix from yceruto #23927 (comment) |
$form->setData($existing); | ||
$form->submit(null); | ||
|
||
$this->assertInternalType('array', $form->getData()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add other common asserts instead?
$this->assertEquals(array(), $form->getData());
$this->assertEquals(array(), $form->getNormData());
$this->assertSame(array(), $form->getViewData(), 'View data is always an array');
The fix should be since |
@stoccc You will now also have to rebase your PR to get rid of the additional commits. |
@xabbuh Can I do it inside github? How? |
I don't think that the GitHub UI supports this yet. But you can use git locally for it. We have a description of the process on http://symfony.com/doc/current/contributing/code/patches.html#rebase-your-patch. Otherwise, you can of course create a new PR. You will then just need to recreate your commits too. |
…field with multiple=true (stoccc) This PR was squashed before being merged into the 2.7 branch (closes #23980). Discussion ---------- Tests and fix for issue in array model data in EntityType field with multiple=true | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | License | MIT | Fixed tickets | #23927 Provided some tests and the fix for #23927. Rebased to 2.7, replaces #23930 Commits ------- aaba6b4 Tests and fix for issue in array model data in EntityType field with multiple=true
Added some tests for #23927
Provided some tests for #23927