Files
loggerFactory/tests/OptionsTest.php
2025-05-02 15:35:39 +02:00

76 lines
1.9 KiB
PHP

<?php
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\LoggerFactory\tests;
use D3\LoggerFactory\Options;
use D3\LoggerFactory\Options\FileLoggerHandlerOption;
use D3\LoggerFactory\Options\OptionInterface;
use D3\LoggerFactory\Options\UidProcessorOption;
use D3\LoggerFactory\tests\Helpers\UnknownOption;
use Monolog\Logger;
use ReflectionException;
/**
* @coversNothing
*/
class OptionsTest extends AbstractTestCase
{
/**
* @test
* @throws ReflectionException
* @covers \D3\LoggerFactory\Options::add
*/
public function testAdd(): void
{
$sut = new Options();
$sut->add(new FileLoggerHandlerOption('file/path.log', Logger::INFO, 5));
$sut->add(new UidProcessorOption());
$sut->add(new UnknownOption());
$this->assertCount(
3,
$this->getValue(
$sut,
'options'
)
);
}
/**
* @test
* @throws ReflectionException
* @covers \D3\LoggerFactory\Options::getAll
*/
public function testGetAll(): void
{
$sut = new Options();
$sut->add(new FileLoggerHandlerOption('file/path.log', Logger::INFO, 5));
$sut->add(new UidProcessorOption());
$sut->add(new UnknownOption());
$all = $this->callMethod(
$sut,
'getAll',
);
$this->assertCount(3, $all);
$this->assertIsArray($all);
$this->assertContainsOnlyInstancesOf(OptionInterface::class, $all);
}
}