JeffreyWay / Laravel-Testing-Decoded

This project is exclusively for reporting typos and errors in the book, "Laravel Testing Decoded."
34 stars 10 forks source link

testFormSelectYear() and all related methods already exist in framework #94

Open jeremyvaught opened 11 years ago

jeremyvaught commented 11 years ago

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.

develpr commented 10 years ago

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

jeremyvaught commented 10 years ago

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