Created
June 21, 2012 18:58
-
-
Save cgmartin/2967806 to your computer and use it in GitHub Desktop.
ZF2-338 unit test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Inside ZendTest\Form\View\Helper\FormSelectTest | |
public function getScalarOptionsDataProvider() | |
{ | |
return array( | |
array(array('string' => 'value')), | |
array(array('int' => 1)), | |
array(array('int-neg' => -1)), | |
array(array('hex' => 0x1A)), | |
array(array('oct' => 0123)), | |
array(array('float' => 2.1)), | |
array(array('float-e' => 1.2e3)), | |
array(array('float-E' => 7E-10)), | |
array(array('bool-t' => true)), | |
array(array('bool-f' => false)), | |
); | |
} | |
/** | |
* @group ZF2-338 | |
* @dataProvider getScalarOptionsDataProvider | |
*/ | |
public function testScalarOptionValues($options) | |
{ | |
$element = new Element('foo'); | |
$element->setAttribute('options', $options); | |
$markup = $this->helper->render($element); | |
list($label, $value) = each($options); | |
$this->assertRegexp(sprintf('#option .*?value="%s"#', (string)$value), $markup); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment