public function testsetValues_DataArrayPassedToMethod() { // create multiselect "Snacks" with three options $this->form->addElement('multiselect')->setName('Snacks')->setOptions(array('cola' => 'Cola', 'popcorn' => 'Popcorn', 'peanuts' => 'Peanuts')); // two options were selected (array is incomming via post) $data = array('snacks' => array('cola', 'popcorn')); $this->form->setValues($data); $snacks_array = $this->form->getElementByName('Snacks')->getValue(); $this->assertIdentical(count($snacks_array), 2); $this->assertIdentical($snacks_array[0], 'cola'); $this->assertIdentical($snacks_array[1], 'popcorn'); }