From 00e38198b7859f38ab87405d13b4cffda8619461 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Wed, 17 Feb 2016 20:31:02 +0100 Subject: [PATCH] [Form] add test for ArrayChoiceList handling null --- .../Form/Tests/ChoiceList/AbstractChoiceListTest.php | 7 +++++++ .../Form/Tests/ChoiceList/ArrayChoiceListTest.php | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php index 958bb66d506b0..08e4285f0cd53 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTest.php @@ -209,6 +209,13 @@ public function testGetValuesForChoicesEmpty() $this->assertSame(array(), $this->list->getValuesForChoices(array())); } + public function testGetChoicesForValuesWithNull() + { + $values = $this->list->getValuesForChoices(array(null)); + + $this->assertNotEmpty($this->list->getChoicesForValues($values)); + } + /** * @return \Symfony\Component\Form\ChoiceList\ChoiceListInterface */ diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php index 9ea5f631a1585..f054fd70c07a6 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/ArrayChoiceListTest.php @@ -22,9 +22,9 @@ class ArrayChoiceListTest extends AbstractChoiceListTest protected function setUp() { - parent::setUp(); - $this->object = new \stdClass(); + + parent::setUp(); } protected function createChoiceList() @@ -34,12 +34,12 @@ protected function createChoiceList() protected function getChoices() { - return array(0, 1, '1', 'a', false, true, $this->object); + return array(0, 1, '1', 'a', false, true, $this->object, null); } protected function getValues() { - return array('0', '1', '2', '3', '4', '5', '6'); + return array('0', '1', '2', '3', '4', '5', '6', '7'); } /** pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy