Makoto
Makoto
Laravel
Comparte:

Curso API - Crear test de trait

he creado un test para probar el trait de sort en los modelos, pero al momento de probar el test de "unknown_fields" no me devuelve el ExceptionCode
/** @test */
public function it_cannot_sort_models_by_unknown_fields()
{
    $this->expectException(\Symfony\Component\HttpKernel\Exception\HttpException::class);
    $this->expectExceptionCode(400);
    $this->expectExceptionMessage('Invalid Query Parameter, unknown is not allowed.');

    ModelHasSorts::applySorts('unknown')->get();
}

y en la consola me muesta Failed asserting that 0 is equal to expected exception code 400.