mateusjatenee's avatar

Test gets an OK but does not works

Hello everyone,
I have the following test:

    public function testCreation()
    {
        $user = User::create([
            'name' => str_random(5),
            'email' => str_random(5).'@test.com',
            'password' => Hash::make('test')
            ]);
        $name = str_random(7);
        $this->actingAs($user)
             ->withSession(['foo' => 'bar'])
             ->visit('/evento/novo')
             ->type($name, 'name')
             ->type('Avenida Weenside', 'address')
             ->type(date('d/m/Y'), 'date')
             ->select('01:00', 'event-date-time')
             ->type('Unit test', 'description')
             ->select('1', 'optionsRadios')
             ->select('1', 'eventVisibility')
             ->type('Ticket 1', 'tickets[0][name]')
             ->type('200', 'tickets[0][quantity]')
             ->type('50', 'tickets[0][value]')
             ->attach('/public/events_images/flyer/1-flyer.jpg', 'flyer')
             ->attach('/public/events_images/banner/1-banner.jpg', 'banner')
             ->press('Publicar evento')
             ->seePageIs('/evento/' . $name);

    }

It fills a form and submits it. A record should be added to the database but it's not and it is also redirecting to the wrong page - it redirects to '/'. The test is getting an OK, however.
Does anyone knows what to do?

0 likes
1 reply

Please or to participate in this conversation.