<commit_before><?php

declare(strict_types=1);

namespace SimpleSAML\Test;

use Exception;
use PHPUnit\Framework\TestCase;
use SimpleSAML\Configuration;
use SimpleSAML\Logger;
use SimpleSAML\TestUtils\ArrayLogger;

class LoggerTest extends TestCase
{
    /**
     * @var \SimpleSAML\Logger\LoggingHandlerInterface|null
     */
    protected $originalLogger;


    /**
     * @param string $handler
     */
    protected function setLoggingHandler(string $handler): void
    {
        $this->originalLogger = Logger::getLoggingHandler();
        $config = [
            'logging.handler' => $handler,
            'logging.level' => Logger::DEBUG
        ];

        // testing static methodss is slightly painful
        Configuration::loadFromArray($config, '[ARRAY]', 'simplesaml');
        Logger::setLoggingHandler(null);
    }


    /**
     */
    protected function tearDown(): void
    {
        if (isset($this->originalLogger)) {
            // reset the logger and Configuration
            Configuration::clearInternalState();
            Logger::clearCapturedLog();
            Logger::setLogLevel(Logger::INFO);
            Logger::setLoggingHandler($this->originalLogger);
        }
    }


    /**
     */
    public function testCreateLoggingHandlerHonorsCustomHandler(): void
    {<commit_msg>Fix typo<commit_after><?php

declare(strict_types=1);

namespace SimpleSAML\Test;

use Exception;
use PHPUnit\Framework\TestCase;
use SimpleSAML\Configuration;
use SimpleSAML\Logger;
use SimpleSAML\TestUtils\ArrayLogger;

class LoggerTest extends TestCase
{
    /**
     * @var \SimpleSAML\Logger\LoggingHandlerInterface|null
     */
    protected $originalLogger;


    /**
     * @param string $handler
     */
    protected function setLoggingHandler(string $handler): void
    {
        $this->originalLogger = Logger::getLoggingHandler();
        $config = [
            'logging.handler' => $handler,
            'logging.level' => Logger::DEBUG
        ];

        // testing static methods is slightly painful
        Configuration::loadFromArray($config, '[ARRAY]', 'simplesaml');
        Logger::setLoggingHandler(null);
    }


    /**
     */
    protected function tearDown(): void
    {
        if (isset($this->originalLogger)) {
            // reset the logger and Configuration
            Configuration::clearInternalState();
            Logger::clearCapturedLog();
            Logger::setLogLevel(Logger::INFO);
            Logger::setLoggingHandler($this->originalLogger);
        }
    }


    /**
     */
    public function testCreateLoggingHandlerHonorsCustomHandler(): void
    {
{'fraction_non_alphanumeric': 0.11782708492731446, 'fraction_numerical': 0.0007651109410864575, 'mean_word_length': 2.6319444444444446, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1194813', 'n_tokens_mistral': 712, 'n_tokens_neox': 685, 'n_words': 133}