livewire / volt

Volt is an elegantly crafted functional API for Livewire.
https://livewire.laravel.com/docs/volt
MIT License
327 stars 19 forks source link

The `assertSessionHas()` does not work with flash messages. #54

Closed robsontenorio closed 11 months ago

robsontenorio commented 11 months ago

Volt Version

1.3.2

Laravel Version

10.23

PHP Version

8.2

Database Driver & Version

No response

Description

The assertSessionHas() does not work with flash messages.

Steps To Reproduce

Volt component

<?php

use Livewire\Volt\Component;

new class extends Component
{
    public function save()
    {
        session()->flash('message', 'ops!');
    }
}; ?>

<div>
    volt abc
</div>

Test

Volt::test('mycomponent')
            ->call('save')
            ->assertSessionHas('message', 'ops!');

Fail

image
inmanturbo commented 11 months ago

does this work for you with other session data? or is it only flash data?

robsontenorio commented 11 months ago

@inmanturbo

flash() does not work. session([x => y]) works.

But the issue here is about testing flash() messages.

nunomaduro commented 11 months ago

Can you double check if this issue also happens when using regular Livewire components? If not, please re-open this issue.