Setting preconditions

Last updated at 23 March 2018 | Published at 04 March 2018

Often you’ll want to set up preconditions for tests. These are events recorded prior to the interaction you want to test in the current scenario. This can be provided using the given method. This method receives one or more events:

class SignUpRespectsBlackListTest extends SignUpProcessTestCase
{
    /**
     * @test
     */
    public function blacklist_is_respected()
    {
        $this->given(
            new SignUpWasInitiated(),
            new EmailWasSpecifiedForSignUp('[email protected]')
        )->when(
            new FinalizeSignUpProcess()
        )->then(
            new SignUpWasFinalized()
        );
    } 
}