<?php declare(strict_types=1);

require_once __DIR__ . '/../../../src/storage/file/QrbLogFile.php';

use PHPUnit\Framework\TestCase;

final class QrbLogFileTest extends TestCase
{
    private const TIME_STAMP = "2099-12-31";    // some string
    private const TEST_OUTPUT_PATH = "../../../LogFileTest";
    
    private $path;
    private QrbLogFile $qrbLogFile;
    
    protected function setUp() : void
    {
        $this->path = self::TEST_OUTPUT_PATH;
        $this->qrbLogFile = new QrbLogFile($this->path, false);
    }
    
    protected function tearDown() : void
    {
        QrbFiles::deletePath($this->path, true);
    }

    public function testWrite() : void
    {
        $result = $this->qrbLogFile->write("Test");
        $this->assertTrue($result && ($result > 4));
    }

    public function testWriteAdditionalLines() : void
    {
        $testArray = array("Item1", "Item2", "Item3"); 
        $result = $this->qrbLogFile->write("Test", $testArray);
        $this->assertTrue($result && ($result > 19));
    }
}

?>
