<commit_before><?php

namespace Korobi\WebBundle\Test\Unit;

use Korobi\WebBundle\Document\Chat;
use Korobi\WebBundle\Parser\LogParser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

/**
 * Class ParserTest
 * @see LogParser
 * @package Korobi\WebBundle\Test\Unit
 */
class ParserTest extends WebTestCase {

    public function testShutUpPhpUnit() {
        $this->assertTrue(true);
    }

    public function testParseJoin() {
        /** @see LogParser::parseJoin */
        $chat = $this->getMockBuilder('Korobi\WebBundle\Document\Chat')
            ->disableOriginalConstructor()
            ->getMock();

        $chat->expects($this->any())->method("getDate")->will($this->returnValue(new \DateTime("@0")));
        $chat->expects($this->any())->method("getActorName")->will($this->returnValue("TestUser"));
        $chat->expects($this->any())->method("getActorPrefix")->will($this->returnValue("OPERATOR"));
        $chat->expects($this->any())->method("getActorHostname")->will($this->returnValue("user@host"));

        $this->assertEquals('<span class="irc--09-99">@</span>TestUser (user@host) joined the channel', LogParser::parseJoin($chat));
    }

    public function testParseMessage() {
        /** @see LogParser::parseMessage */
        $chat = $this->getMockBuilder('Korobi\WebBundle\Document\Chat')
            ->disableOriginalConstructor()
            ->getMock();

        $chat->expects($this->any())->method("getDate")->will($this->returnValue(new \DateTime("@0")));
        $chat->expects($this->any())->method("getActorName")->will($this->returnValue("TestUser"));
        $chat->expects($this->any())->method("getActorPrefix")->will($this->returnValue("OPERATOR"));
        $chat->expects($this->any())->method("getMessage")->will($this->returnValue("\x0307,04Hello!"));
        $this->assertEquals('<span class="irc--07-04">Hello!</span>', LogParser::parseMessage($chat));
    }


    public function testParseMessageWithReverseColour() {
        /** @see LogParser::parseMessage */
        $chat = $this->getMockBuilder('Korobi\WebBundle\Document\Chat')
            ->disableOriginalConstructor()
            ->getMock();

        $chat->expects($this->any())->method("getDate")->will($this->returnValue(new \DateTime("@0")));
        $chat->expects($this->any())->method("getActorName")->will($this->returnValue("TestUser"));
        $chat->expects($this->any())->method("getActorPrefix")->will($this->returnValue("OPERATOR"));
        $chat->expects($this->any())->method("getMessage")->will($this->returnValue("\x0307,04\x16Hello!"));
        $this->assertEquals('<span class="irc--07-04"><span class="irc--04-07">Hello!</span></span>', LogParser::parseMessage($chat));
    }



}<commit_msg>Add test case for single colour reset<commit_after><?php

namespace Korobi\WebBundle\Test\Unit;

use Korobi\WebBundle\Document\Chat;
use Korobi\WebBundle\Parser\LogParser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

/**
 * Class ParserTest
 * @see LogParser
 * @package Korobi\WebBundle\Test\Unit
 */
class ParserTest extends WebTestCase {

    public function testShutUpPhpUnit() {
        $this->assertTrue(true);
    }

    public function testParseJoin() {
        /** @see LogParser::parseJoin */
        $chat = $this->getMockBuilder('Korobi\WebBundle\Document\Chat')
            ->disableOriginalConstructor()
            ->getMock();

        $chat->expects($this->any())->method("getDate")->will($this->returnValue(new \DateTime("@0")));
        $chat->expects($this->any())->method("getActorName")->will($this->returnValue("TestUser"));
        $chat->expects($this->any())->method("getActorPrefix")->will($this->returnValue("OPERATOR"));
        $chat->expects($this->any())->method("getActorHostname")->will($this->returnValue("user@host"));

        $this->assertEquals('<span class="irc--09-99">@</span>TestUser (user@host) joined the channel', LogParser::parseJoin($chat));
    }

    public function testParseMessage() {
        /** @see LogParser::parseMessage */
        $chat = $this->getMockBuilder('Korobi\WebBundle\Document\Chat')
            ->disableOriginalConstructor()
            ->getMock();

        $chat->expects($this->any())->method("getDate")->will($this->returnValue(new \DateTime("@0")));
        $chat->expects($this->any())->method("getActorName")->will($this->returnValue("TestUser"));
        $chat->expects($this->any())->method("getActorPrefix")->will($this->returnValue("OPERATOR"));
        $chat->expects($this->any())->method("getMessage")->will($this->returnValue("\x0307,04Hello!"));
        $this->assertEquals('<span class="irc--07-04">Hello!</span>', LogParser::parseMessage($chat));
    }


    public function testParseMessageWithReverseColour() {
        /** @see LogParser::parseMessage */
        $chat = $this->getMockBuilder('Korobi\WebBundle\Document\Chat')
            ->disableOriginalConstructor()
            ->getMock();

        $chat->expects($this->any())->method("getDate")->will($this->returnValue(new \DateTime("@0")));
        $chat->expects($this->any())->method("getActorName")->will($this->returnValue("TestUser"));
        $chat->expects($this->any())->method("getActorPrefix")->will($this->returnValue("OPERATOR"));
        $chat->expects($this->any())->method("getMessage")->will($this->returnValue("\x0307,04\x16Hello!"));
        $this->assertEquals('<span class="irc--07-04"><span class="irc--04-07">Hello!</span></span>', LogParser::parseMessage($chat));
    }

    public function testParseMessageWithSingleColourAsReset() {
        /** @see LogParser::parseMessage */
        $chat = $this->getMockBuilder('Korobi\WebBundle\Document\Chat')
            ->disableOriginalConstructor()
            ->getMock();

        // {3}13Red_Sky{3} plays {3}0,04 Red 7 {3}  {3}to {3}06Kashike

        $chat->expects($this->any())->method("getDate")->will($this->returnValue(new \DateTime("@0")));
        $chat->expects($this->any())->method("getActorName")->will($this->returnValue("TestUser"));
        $chat->expects($this->any())->method("getActorPrefix")->will($this->returnValue("OPERATOR"));
        $chat->expects($this->any())->method("getMessage")->will($this->returnValue("\x0313Red_Sky\x03 plays \x030,04 Red 7 \x03 \x03 to \x0306Kashike"));
        $this->assertEquals('<span class="irc--13-99">Red_Sky</span> plays <span class="irc--00-04"> Red 7 </span>  to <span class="irc--06-04">Kashike</span>', LogParser::parseMessage($chat));
    }



}
{'fraction_non_alphanumeric': 0.217209949019002, 'fraction_numerical': 0.01761161748802719, 'mean_word_length': 4.121835443037975, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 195, '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': '1780460', 'n_tokens_mistral': 2016, 'n_tokens_neox': 1940, 'n_words': 206}