vm's avatar
Level 2

how to test with codeception when there is an if statement

In the sample code below how do I let codeception skip the first part of if statement

``` public function store() {

//fetch the form input $formData = Input::only('email', 'password');

    // validate the form

    $this->signInForm->validate($formData);

    // invalid then go back

    if(Auth::attempt([
        'email' => Input::get('email'),
        'password' => Input::get('password'),

    ]))
    {
        if(something checksout())
        {

             return that;
        }


        Flash::message('Welcome back!');


        return this;

    }

Thx

0 likes
1 reply
thepsion5's avatar

You have two separate tests, one that tests one execution path (the if clause), and one that tests the other (the else clause).

1 like

Please or to participate in this conversation.