<commit_before><?php

namespace Botonomous;

use /* @noinspection PhpUndefinedClassInspection */
    GuzzleHttp\Client;
use PHPUnit\Framework\TestCase;

class SenderTest extends TestCase
{
    const VERIFICATION_TOKEN = 'verificationToken';

    private function getSlackbot()
    {
        $config = new Config();
        $config->set('chatLogging', false);

        $slackbot = new Slackbot($config);

        /**
         * Overwrite the slackbot.
         */
        $request = [
            'token'     => $config->get(self::VERIFICATION_TOKEN),
            'user_id'   => 'dummyId',
            'user_name' => 'dummyUsername',
            'debug'     => true
        ];

        // get listener
        $listener = $slackbot->getListener();

        // set request
        $listener->setRequest($request);

        $slackbot->setConfig($config);

        return $slackbot;
    }

    public function testSendDebug()
    {
        $sender = new Sender($this->getSlackbot());

        $sender->send('test response 2', '#dummyChannel', []);

        $response = '{"text":"test response 2","channel":"#dummyChannel","attachments":"[]"}';

        $this->expectOutputString($response);
    }

    public function testSendSlackJson()
    {
        $sender = new Sender($this->getSlackbot());

        $sender->send('test response 3', '#dummyChannel');

        $response = '{"text":"test response 3","channel":"#dummyChannel"}';

        $this->expectOutputString($response);
    }

    public function testSendSlackSlack()
    {
        $sender = new Sender($this->getSlackbot());

        $sender->send('test response 4', '#dummyChannel');

        $response = '{"text":"test response 4","channel":"#dummyChannel"}';

        $this->expectOutputString($response);
    }

    public function testGetConfig()
    {
        $config = new Config();
        $originalChannel = $config->get('channel');
        $config->set('channel', $originalChannel.'Changed');

        $sender = new Sender((new Slackbot()));
        $sender->setConfig($config);

        $this->assertEquals($config, $sender->getConfig());

        // reset config value
        $config->set('channel', $originalChannel);
    }

    public function testGetClient()
    {
        $client = new Client();

        $sender = new Sender((new Slackbot()));
        $this->assertEquals($client, $sender->getClient());
    }
}
<commit_msg>Apply fixes from StyleCI<commit_after><?php

namespace Botonomous;

use /* @noinspection PhpUndefinedClassInspection */
    GuzzleHttp\Client;
use PHPUnit\Framework\TestCase;

class SenderTest extends TestCase
{
    const VERIFICATION_TOKEN = 'verificationToken';

    private function getSlackbot()
    {
        $config = new Config();
        $config->set('chatLogging', false);

        $slackbot = new Slackbot($config);

        /**
         * Overwrite the slackbot.
         */
        $request = [
            'token'     => $config->get(self::VERIFICATION_TOKEN),
            'user_id'   => 'dummyId',
            'user_name' => 'dummyUsername',
            'debug'     => true,
        ];

        // get listener
        $listener = $slackbot->getListener();

        // set request
        $listener->setRequest($request);

        $slackbot->setConfig($config);

        return $slackbot;
    }

    public function testSendDebug()
    {
        $sender = new Sender($this->getSlackbot());

        $sender->send('test response 2', '#dummyChannel', []);

        $response = '{"text":"test response 2","channel":"#dummyChannel","attachments":"[]"}';

        $this->expectOutputString($response);
    }

    public function testSendSlackJson()
    {
        $sender = new Sender($this->getSlackbot());

        $sender->send('test response 3', '#dummyChannel');

        $response = '{"text":"test response 3","channel":"#dummyChannel"}';

        $this->expectOutputString($response);
    }

    public function testSendSlackSlack()
    {
        $sender = new Sender($this->getSlackbot());

        $sender->send('test response 4', '#dummyChannel');

        $response = '{"text":"test response 4","channel":"#dummyChannel"}';

        $this->expectOutputString($response);
    }

    public function testGetConfig()
    {
        $config = new Config();
        $originalChannel = $config->get('channel');
        $config->set('channel', $originalChannel.'Changed');

        $sender = new Sender((new Slackbot()));
        $sender->setConfig($config);

        $this->assertEquals($config, $sender->getConfig());

        // reset config value
        $config->set('channel', $originalChannel);
    }

    public function testGetClient()
    {
        $client = new Client();

        $sender = new Sender((new Slackbot()));
        $this->assertEquals($client, $sender->getClient());
    }
}

{'fraction_non_alphanumeric': 0.16112266112266113, 'fraction_numerical': 0.002494802494802495, 'mean_word_length': 2.5584319526627217, 'pattern_counts': {'":': 14, '<': 5, '<?xml version=': 0, '>': 55, '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': '498940', 'n_tokens_mistral': 1387, 'n_tokens_neox': 1325, 'n_words': 259}