1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Laravel Livewire test assertSet

Discussão em 'Outras Linguagens' iniciado por Christian Wagner, Outubro 1, 2024 às 10:32.

  1. I often have problems with Livewire Tests and assertSet() and Model properties - for exampel:

    ->assertSet('model', Model::first())


    throws an Failed asserting that two objects are equal error because the actual Object has an attributeCastCache or changes.

    I always end up doing a workarround and store the component in a variable

    $component = Livewire::test(Component::class);

    $this->assertSame($component->model, Model::first());

    Is there an other way?

    Continue reading...

Compartilhe esta Página