public function testSetDataSources() { $ds1 = new HTML_QuickForm2_DataSource_Array(array('key' => 'value')); $ds2 = new HTML_QuickForm2_DataSource_Array(array('another key' => 'foo')); $form = new HTML_QuickForm2('dstest'); $this->assertEquals(0, count($form->getDataSources())); $form->addDataSource($ds2); $this->assertEquals(1, count($form->getDataSources())); $form->setDataSources(array($ds1, $ds2)); $this->assertEquals(2, count($form->getDataSources())); try { $form->setDataSources(array($ds1, 'bogus', $ds2)); } catch (HTML_QuickForm2_InvalidArgumentException $e) { return; } $this->fail('Expected HTML_QuickForm2_InvalidArgumentException was not thrown'); }