<?php

declare(strict_types=1);

namespace {{ tree.getFullNameSpaceOfFile(file, entity, action) }};

class {{ helper.getClassName(file, entity, action) }} extends {{ helper.getClassName(helper.findFile('AbstractItemTestBase'), entity, action) }}
{
    protected static function getPath(): string
    {
        return "{{ entity.name }}/{{ action }}";
    }

    public function test{{ action + entity.name }}()
    {
        $User = $this->createUser();
        $Item = $this->makeItem($User);
        $Item->save();
        $Response = $this->deleteJson($this->makeUri($Item->Id))
            ->assertStatus(401);

        $OtherUser = $this->createUser();
        $this->actingAs($OtherUser);

        $Response = $this->deleteJson($this->makeUri($Item->Id))
            ->assertStatus(403);

        $this->actingAs($User);

        $Response = $this->deleteJson($this->makeUri($Item->Id))
            ->assertStatus(200);

        $Response = $this->deleteJson($this->makeUri($Item->Id))
            ->assertStatus(404);
    }
}
