Laravel-Testing-Decoded icon indicating copy to clipboard operation
Laravel-Testing-Decoded copied to clipboard

testFormSelectYear() and all related methods already exist in framework

Open jeremyvaught opened this issue 12 years ago • 2 comments

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.

jeremyvaught avatar Oct 22 '13 15:10 jeremyvaught

+1? Is there a way to say "yes, this is a problem" on github? Can I vote or something?

develpr avatar Nov 08 '13 01:11 develpr

You pretty much just did. :) :+1: It's up to Jeffrey now.

jeremyvaught avatar Nov 08 '13 01:11 jeremyvaught