<commit_before><?php
/**
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @since         2.0.0
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
namespace Cake\Test\TestCase\Core;

use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\TestSuite\TestCase;

/**
 * PluginTest class
 *
 */
class PluginTest extends TestCase {

/**
 * Reverts the changes done to the environment while testing
 *
 * @return void
 */
	public function tearDown() {
		parent::tearDown();
		Plugin::unload();
	}

/**
 * Tests loading a single plugin
 *
 * @return void
 */
	public function testLoadSingle() {
		Plugin::unload();
		Plugin::load('TestPlugin');
		$expected = array('TestPlugin');
		$this->assertEquals($expected, Plugin::loaded());
	}

/**
 * Tests unloading plugins
 *
 * @return void
 */
	public function testUnload() {
		Plugin::load('TestPlugin');
		$expected = array('TestPlugin');
		$this->assertEquals($expected, Plugin::loaded());

		Plugin::unload('TestPlugin');
		$this->assertEquals(array(), Plugin::loaded());

		Plugin::load('TestPlugin');
		$expected = array('TestPlugin');
		$this->assertEquals($expected, Plugin::loaded());

		Plugin::unload('TestFakePlugin');
		$this->assertEquals($expected, Plugin::loaded());
	}

/**
 * Test load() with the autoload option.
 *
 * @return void
 */
	public function testLoadSingleWithAutoload() {
		$this->assertFalse(class_exists('Company/TestPluginThree\Utility\Hello'));
		Plugin::load('Company/TestPluginThree', [
			'autoload' => true,
		]);
		$this->assertTrue(
			class_exists('Company\TestPluginThree\Utility\Hello'),
			'Class should be loaded'
		);
	}

/**
 * Tests loading a plugin and its bootstrap file
 *
 * @return void<commit_msg>Fix slash in namespace.<commit_after><?php
/**
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @since         2.0.0
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
namespace Cake\Test\TestCase\Core;

use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\TestSuite\TestCase;

/**
 * PluginTest class
 *
 */
class PluginTest extends TestCase {

/**
 * Reverts the changes done to the environment while testing
 *
 * @return void
 */
	public function tearDown() {
		parent::tearDown();
		Plugin::unload();
	}

/**
 * Tests loading a single plugin
 *
 * @return void
 */
	public function testLoadSingle() {
		Plugin::unload();
		Plugin::load('TestPlugin');
		$expected = array('TestPlugin');
		$this->assertEquals($expected, Plugin::loaded());
	}

/**
 * Tests unloading plugins
 *
 * @return void
 */
	public function testUnload() {
		Plugin::load('TestPlugin');
		$expected = array('TestPlugin');
		$this->assertEquals($expected, Plugin::loaded());

		Plugin::unload('TestPlugin');
		$this->assertEquals(array(), Plugin::loaded());

		Plugin::load('TestPlugin');
		$expected = array('TestPlugin');
		$this->assertEquals($expected, Plugin::loaded());

		Plugin::unload('TestFakePlugin');
		$this->assertEquals($expected, Plugin::loaded());
	}

/**
 * Test load() with the autoload option.
 *
 * @return void
 */
	public function testLoadSingleWithAutoload() {
		$this->assertFalse(class_exists('Company\TestPluginThree\Utility\Hello'));
		Plugin::load('Company/TestPluginThree', [
			'autoload' => true,
		]);
		$this->assertTrue(
			class_exists('Company\TestPluginThree\Utility\Hello'),
			'Class should be loaded'
		);
	}

/**
 * Tests loading a plugin and its bootstrap file
 *
 * @return void
{'fraction_non_alphanumeric': 0.15928571428571428, 'fraction_numerical': 0.0014285714285714286, 'mean_word_length': 4.257822277847309, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7640624', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1249, 'n_words': 298}