<commit_before><?php
/**
 * Copyright 2017 The WildPHP Team
 *
 * You should have received a copy of the MIT license with the project.
 * See the LICENSE file for more information.
 */

use PHPUnit\Framework\TestCase;
use WildPHP\Core\Users\BotStateManager;

class BotStateManagerTest extends TestCase
{
	/**
	 * @var \WildPHP\Core\ComponentContainer
	 */
	protected $container;
	
	
	public function setUp()
	{
		$this->container = new \WildPHP\Core\ComponentContainer();
		$this->container->add(new \WildPHP\Core\EventEmitter());
		$this->container->add(new \WildPHP\Core\Logger\Logger('wildphp'));
		$neonBackend = new \WildPHP\Core\Configuration\NeonBackend(dirname(__FILE__) . '/emptyconfig.neon');
		$configuration = new \WildPHP\Core\Configuration\Configuration($neonBackend);
		$configuration['currentNickname'] = 'Test';
		$this->container->add($configuration);
	}

	public function testMonitorOwnNickname()
	{
		$botStateManager = new BotStateManager($this->container);
		
		$channel = new \WildPHP\Core\Channels\Channel('#test', new \WildPHP\Core\Users\UserCollection(), new \WildPHP\Core\Channels\ChannelModes(''));
		$user = new \WildPHP\Core\Users\User('Test');
		$oldNickname = 'Test';
		$newNickname = 'Testing';
		$botStateManager->monitorOwnNickname($channel, $user, $oldNickname, $newNickname);
		
		self::assertEquals('Testing', \WildPHP\Core\Configuration\Configuration::fromContainer($this->container)['currentNickname']);

		$channel = new \WildPHP\Core\Channels\Channel('#test', new \WildPHP\Core\Users\UserCollection(), new \WildPHP\Core\Channels\ChannelModes(''));
		$user = new \WildPHP\Core\Users\User('Test');
		$oldNickname = 'Test';
		$newNickname = 'Testing123';
		$botStateManager->monitorOwnNickname($channel, $user, $oldNickname, $newNickname);

		self::assertEquals('Testing', \WildPHP\Core\Configuration\Configuration::fromContainer($this->container)['currentNickname']);
	}
}
<commit_msg>Add testIsCompatible<commit_after><?php
/**
 * Copyright 2017 The WildPHP Team
 *
 * You should have received a copy of the MIT license with the project.
 * See the LICENSE file for more information.
 */

use PHPUnit\Framework\TestCase;
use WildPHP\Core\Users\BotStateManager;

class BotStateManagerTest extends TestCase
{
	/**
	 * @var \WildPHP\Core\ComponentContainer
	 */
	protected $container;
	
	
	public function setUp()
	{
		$this->container = new \WildPHP\Core\ComponentContainer();
		$this->container->add(new \WildPHP\Core\EventEmitter());
		$this->container->add(new \WildPHP\Core\Logger\Logger('wildphp'));
		$neonBackend = new \WildPHP\Core\Configuration\NeonBackend(dirname(__FILE__) . '/emptyconfig.neon');
		$configuration = new \WildPHP\Core\Configuration\Configuration($neonBackend);
		$configuration['currentNickname'] = 'Test';
		$this->container->add($configuration);
	}

	public function testMonitorOwnNickname()
	{
		$botStateManager = new BotStateManager($this->container);
		
		$channel = new \WildPHP\Core\Channels\Channel('#test', new \WildPHP\Core\Users\UserCollection(), new \WildPHP\Core\Channels\ChannelModes(''));
		$user = new \WildPHP\Core\Users\User('Test');
		$oldNickname = 'Test';
		$newNickname = 'Testing';
		$botStateManager->monitorOwnNickname($channel, $user, $oldNickname, $newNickname);
		
		self::assertEquals('Testing', \WildPHP\Core\Configuration\Configuration::fromContainer($this->container)['currentNickname']);

		$channel = new \WildPHP\Core\Channels\Channel('#test', new \WildPHP\Core\Users\UserCollection(), new \WildPHP\Core\Channels\ChannelModes(''));
		$user = new \WildPHP\Core\Users\User('Test');
		$oldNickname = 'Test';
		$newNickname = 'Testing123';
		$botStateManager->monitorOwnNickname($channel, $user, $oldNickname, $newNickname);

		self::assertEquals('Testing', \WildPHP\Core\Configuration\Configuration::fromContainer($this->container)['currentNickname']);
	}

	public function testIsCompatible()
	{
		if (!defined('WPHP_VERSION'))
			define('WPHP_VERSION', '3.0.0');

		self::assertEquals(WPHP_VERSION, BotStateManager::getSupportedVersionConstraint());
	}
}

{'fraction_non_alphanumeric': 0.1585696670776819, 'fraction_numerical': 0.004192355117139334, 'mean_word_length': 5.638297872340425, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '2620640', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1224, 'n_words': 218}