Laravel-Testing-Decoded
Laravel-Testing-Decoded copied to clipboard
testFormSelectYear() and all related methods already exist in framework
test code line starting 245
public function testFormSelectYear()
{
$select1 = $this->formBuilder->selectYear('year', 2000, 2020);
$select2 = $this->formBuilder->selectYear('year', 2000, 2020, null, array('id' => 'foo'));
$select3 = $this->formBuilder->selectYear('year', 2000, 2020, '2000');
$this->assertContains('<select name="year"><option value="2000">2000</option><option value="2001">2001</option>', $select1);
$this->assertContains('<select id="foo" name="year"><option value="2000">2000</option><option value="2001">2001</option>', $select2);
$this->assertContains('<select name="year"><option value="2000" selected="selected">2000</option><option value="2001">2001</option>', $select3);
}
and FormBuilder.php starting on line 442
/**
* Create a select year field.
*
* @param string $name
* @param string $begin
* @param string $end
* @param string $selected
* @param array $options
* @return string
*/
public function selectYear()
{
return call_user_func_array(array($this, 'selectRange'), func_get_args());
}
However I LOVE the idea of coding/testing using the actual Laravel project.
I guess I'll just name it slightly different and go forward.
+1? Is there a way to say "yes, this is a problem" on github? Can I vote or something?
You pretty much just did. :) :+1: It's up to Jeffrey now.