<?php

declare(strict_types=1);

namespace Seka\Portal\Modul\Statistiky\Tests\Unit\Services\Analyzators;

use Seka\Portal\Modul\Statistiky\Tests\TestCase;
use Seka\Portal\Modul\Statistiky\Services\Import\File;
use Seka\Portal\Modul\Statistiky\Services\Analyzators\CSVHeader;
use Seka\Portal\Modul\Statistiky\Services\Analyzators\CSVDataAnalyzator;
use Seka\Portal\Modul\Statistiky\Services\Analyzators\DataAnalyzatorContract;

/**
 * Class CSVDataAnalyzatorTest
 *
 * @package Seka\Portal\Modul\Statistiky\Tests\Unit\Services\Analyzators
 */
class CSVDataAnalyzatorTest extends TestCase
{
    /**
     * @var \Seka\Portal\Modul\Statistiky\Services\Analyzators\CSVDataAnalyzator
     */
    private CSVDataAnalyzator $analyzer;

    /**
     * @var \Seka\Portal\Modul\Statistiky\Services\Import\File
     */
    private File $file;

    /**
     *
     */
    public function setUp(): void
    {
        parent::setUp();

        $this->analyzer = new CSVDataAnalyzator(CSVHeader::$header);
        $this->file = new File(__DIR__ . '/../DENNY_VYPIS_KONTROL.csv');
    }

    /**
     *
     */
    public function testInstance()
    {
        self::assertInstanceOf(CSVDataAnalyzator::class, $this->analyzer);
    }

    /**
     *
     */
    public function testGetDelimiter()
    {
        $delimiter = CSVDataAnalyzator::getDelimiter($this->file);

        self::assertEquals(',', $delimiter);
    }

    /**
     *
     */
    public function testAnalyze()
    {
        $result = $this->analyzer->analyze(DataAnalyzatorContract::LEXICAL, $this->file);

        self::assertTrue($result);
    }

    /**
     *
     */
    public function testGetErrors()
    {
        self::assertEmpty($this->analyzer->getErrors());
    }

    /**
     *
     */
    public function testGetResults()
    {
        self::assertEmpty($this->analyzer->getResults());
    }
}
