<?php

namespace Test\Routes\Owner\{{ module }};

use App\DBRealTestSupport\TableCreation;
use App\DBRealTestSupport\TransactionSupported\TS{{ module }}Mother;
{{ extraImport }}use App\DBRealTestSupport\TransactionSupported\Session\TSAdminSessionGenerator;
use App\DBRealTestSupport\TransactionSupported\Session\TSHistoryTableMother;
use App\Http\History\HistoryTables;
use Test\TestCase;
use Test\TransactionTrait;

class {{ module }}ListControllerTest extends TestCase
{
    use TransactionTrait;

    private static $session;
    private static $token;
    private static $admin;

    public function init()
    {
        $this->clear();
        list(self::$session, self::$token, self::$admin) = TSAdminSessionGenerator::createAll();
        TSHistoryTableMother::insert(HistoryTables::{{ const }});
    }

    public function clear()
    {
        TSHistoryTableMother::clear();
        TableCreation::clearTables(
{{ clear }}
        );
    }

    public function testList()
    {
        $this->init();

{{ seed }}

        $this->get('{{ getUrl }}', self::$token);

        $response = $this->decoded();
        $this->assertEquals(3, count($response->data));
    }
}
