18
18
use Symfony \Component \Form \ChoiceList \View \ChoiceGroupView ;
19
19
use Symfony \Component \Form \ChoiceList \View \ChoiceListView ;
20
20
use Symfony \Component \Form \ChoiceList \View \ChoiceView ;
21
+ use Symfony \Component \Form \Extension \Core \View \ChoiceView as LegacyChoiceView ;
21
22
22
23
class DefaultChoiceListFactoryTest extends \PHPUnit_Framework_TestCase
23
24
{
@@ -735,8 +736,9 @@ function ($object, $key, $value) {
735
736
*/
736
737
public function testCreateViewForLegacyChoiceList ()
737
738
{
738
- $ preferred = array (new ChoiceView ('Preferred ' , 'x ' , 'x ' ));
739
- $ other = array (new ChoiceView ('Other ' , 'y ' , 'y ' ));
739
+ // legacy ChoiceList instances provide legacy ChoiceView objects
740
+ $ preferred = array (new LegacyChoiceView ('x ' , 'x ' , 'Preferred ' ));
741
+ $ other = array (new LegacyChoiceView ('y ' , 'y ' , 'Other ' ));
740
742
741
743
$ list = $ this ->getMock ('Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface ' );
742
744
@@ -749,8 +751,8 @@ public function testCreateViewForLegacyChoiceList()
749
751
750
752
$ view = $ this ->factory ->createView ($ list );
751
753
752
- $ this ->assertSame ( $ other , $ view ->choices );
753
- $ this ->assertSame ( $ preferred , $ view ->preferredChoices );
754
+ $ this ->assertEquals ( array ( new ChoiceView ( ' Other ' , ' y ' , ' y ' )) , $ view ->choices );
755
+ $ this ->assertEquals ( array ( new ChoiceView ( ' Preferred ' , ' x ' , ' x ' )) , $ view ->preferredChoices );
754
756
}
755
757
756
758
private function assertScalarListWithGeneratedValues (ChoiceListInterface $ list )
0 commit comments