<commit_before><?php

namespace Mero\Monolog;

class MonologComponentTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var MonologComponent MonologComponent instance
     */
    protected $component;

    protected function setUp()
    {
        $this->component = new MonologComponent();
    }

    /**
     * Returns channel configuration.
     *
     * @param array $handler   Handlers configuration
     * @param array $processor Processors configuration
     *
     * @return array Channel configuration
     */
    protected function getChannelConfig(array $handler = [], array $processor = [])
    {
        return [
            'handler' => $handler,
            'processor' => $processor,
        ];
    }

    /**
     * @expectedException \Mero\Monolog\Exception\InvalidHandlerException
     */
    public function testInvalidHandler()
    {
        $this->component->closeChannel('test');
        $this->component->createChannel(
            'test',
            $this->getChannelConfig([
                'invalid_parameter',
            ])
        );
    }

    public function dataProviderInsufficientParameters()
    {
        return [
            [
                [
                    'path' => '@app/runtime/logs/log_'.date('Y-m-d').'.log',
                ],
                [
                    'type' => 'stream',
                ],
                [
                    'type' => 'gelf',
                ],
                [
                    'type' => 'rotating_file',
                    'max_files' => 5,
                ],
                [
                    'type' => 'stream',
                ],
                [
                    'type' => 'yii_db',
                    'table' => 'logs',
                ],
                [
                    'type' => 'yii_mongo',
                    'collection' => 'logs',
                ],
                [
                    'type' => 'hipchat',
                    'token' => 'XXXX',
                ],
                [
                    'type' => 'hipchat',
                    'room' => 'XXXX',
                ],
            ],
        ];
    }

    /**
     * @dataProvider dataProviderInsufficientParameters
     * @expectedException \Mero\Monolog\Exception\InsufficientParametersException
     */
    public function testInsufficientParameters(array $config)
    {
        $this->component->closeChannel('test');
        $this->component->createChannel(
            'test',
            $this->getChannelConfig([
                $config,
            ])
        );
    }
}<commit_msg>SlackHandler: Adding slack to tests for insufficient Parameters<commit_after><?php

namespace Mero\Monolog;

class MonologComponentTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var MonologComponent MonologComponent instance
     */
    protected $component;

    protected function setUp()
    {
        $this->component = new MonologComponent();
    }

    /**
     * Returns channel configuration.
     *
     * @param array $handler   Handlers configuration
     * @param array $processor Processors configuration
     *
     * @return array Channel configuration
     */
    protected function getChannelConfig(array $handler = [], array $processor = [])
    {
        return [
            'handler' => $handler,
            'processor' => $processor,
        ];
    }

    /**
     * @expectedException \Mero\Monolog\Exception\InvalidHandlerException
     */
    public function testInvalidHandler()
    {
        $this->component->closeChannel('test');
        $this->component->createChannel(
            'test',
            $this->getChannelConfig([
                'invalid_parameter',
            ])
        );
    }

    public function dataProviderInsufficientParameters()
    {
        return [
            [
                [
                    'path' => '@app/runtime/logs/log_'.date('Y-m-d').'.log',
                ],
                [
                    'type' => 'stream',
                ],
                [
                    'type' => 'gelf',
                ],
                [
                    'type' => 'rotating_file',
                    'max_files' => 5,
                ],
                [
                    'type' => 'stream',
                ],
                [
                    'type' => 'yii_db',
                    'table' => 'logs',
                ],
                [
                    'type' => 'yii_mongo',
                    'collection' => 'logs',
                ],
                [
                    'type' => 'hipchat',
                    'token' => 'XXXX',
                ],
                [
                    'type' => 'hipchat',
                    'room' => 'XXXX',
                ],
                [
                    'type' => 'slack',
                    'channel' => 'XXXX',
                ],
            ],
        ];
    }

    /**
     * @dataProvider dataProviderInsufficientParameters
     * @expectedException \Mero\Monolog\Exception\InsufficientParametersException
     */
    public function testInsufficientParameters(array $config)
    {
        $this->component->closeChannel('test');
        $this->component->createChannel(
            'test',
            $this->getChannelConfig([
                $config,
            ])
        );
    }
}
{'fraction_non_alphanumeric': 0.12225764110256891, 'fraction_numerical': 0.0003750234389649353, 'mean_word_length': 1.1700569568755086, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 59, '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': '2756278', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1268, 'n_words': 215}