' . '' . ''; $this->registerTestingTemplate('/tags/form/select_options_source/error.html', $template); try { $page = $this->initTemplate('/tags/form/select_options_source/error.html'); $this->assertTrue(false); } catch(WactException $e) { $this->assertWantedPattern('/Could not find component/', $e->getMessage()); } } function testTargetIsNotSupported() { $template = '' . '' . '' . ''; $this->registerTestingTemplate('/tags/form/select_options_source/not_supported.html', $template); try { $page = $this->initTemplate('/tags/form/select_options_source/not_supported.html'); $this->assertTrue(false); } catch(WactException $e) { $this->assertWantedPattern('/Select tag not found/', $e->getMessage()); } } function testTakeOptionsFrom() { $template = '' . '' . '
' . '' . '
' . '
'; $this->registerTestingTemplate('/tags/form/select_options_source/from.html', $template); $page = $this->initTemplate('/tags/form/select_options_source/from.html'); $data = $page->getChild('data'); $data->set('source', $options = array('4' => 'red', '5' => 'blue')); $this->assertEqual($page->capture(), '
'. ''. '
'); } function testOptionsViaRegisterDataSet() { $template = '' . '
' . '' . '
'; $this->registerTestingTemplate('/tags/form/select_options_source/register_dataset.html', $template); $page = $this->initTemplate('/tags/form/select_options_source/register_dataset.html'); $data = $page->getChild('source'); $data->registerDataSet($options = array(array('4' => 'red'), array('5' => 'blue'))); $this->assertEqual($page->capture(), '
'. ''. '
'); } function testOptionsUseNameAndId() { $template = '' . '
' . '' . '
'; $this->registerTestingTemplate('/tags/form/select_options_source/use_name_and_id.html', $template); $page = $this->initTemplate('/tags/form/select_options_source/use_name_and_id.html'); $data = $page->getChild('source'); $data->registerDataSet($options = array(array('id' => '4', 'name' => 'red'), array('id' => '5', 'name' => 'blue'))); $this->assertEqual($page->capture(), '
'. ''. '
'); } function testSeveralTargets() { $template = '' . '
' . '' . '' . '
'; $this->registerTestingTemplate('/tags/form/select_options_source/several_targets.html', $template); $page = $this->initTemplate('/tags/form/select_options_source/several_targets.html'); $data = $page->getChild('source'); $data->registerDataSet($options = array(array('id' => '4', 'name' => 'red'), array('id' => '5', 'name' => 'blue'))); $this->assertEqual($page->capture(), '
'. ''. ''. '
'); } function testWithDefaultOption() { $template = '' . '
' . '' . '
'; $this->registerTestingTemplate('/tags/form/select_options_source/with_default.html', $template); $page = $this->initTemplate('/tags/form/select_options_source/with_default.html'); $data = $page->getChild('source'); $data->registerDataSet($options = array(array('id' => '4', 'name' => 'red'), array('id' => '5', 'name' => 'blue'))); $this->assertEqual($page->capture(), '
'. ''. '
'); } function testOptionsViaRegisterDatasourceAndDefaultOption() { $template = '' . '
' . '' . '
'; $this->registerTestingTemplate('/tags/form/select_options_source/register_datasource_and_default_option.html', $template); $page = $this->initTemplate('/tags/form/select_options_source/register_datasource_and_default_option.html'); $data = $page->getChild('source'); $data->registerDatasource($options = array('4' => 'red', '5' => 'blue')); $this->assertEqual($page->capture(), '
'. ''. '
'); } } ?>