<commit_before><?php

require_once dirname(__FILE__) . '/Bootstrap.php';

class Commands extends PHPUnit_Framework_TestCase
{
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__AddonAdd()
	{
		self::runCommand(array('addon', 'add', self::getAddon(true)));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__AddonSelect()
	{
		self::runCommand(array('addon', 'select', self::getAddon()));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__ExtendAdd()
	{
		self::runCommand(array('extend', 'add', 'XenForo_ControllerPublic_Account'));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__ListenerAdd()
	{
		self::runCommand(array('listener', 'add', 'load_class_controller'));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__RouteAdd()
	{
		self::runCommand(array('route', 'add', strtolower(self::getAddon())));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__TemplateAdd()
	{
		self::runCommand(array('template', 'add', strtolower(self::getAddon())));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__PhraseAdd()
	{
		self::runCommand(array('phrase', 'add', strtolower(self::getAddon()), strtolower(self::getAddon()) ));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__PhraseFind()
	{
		self::runCommand(array('phrase', 'find', strtolower(self::getAddon())));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__PhraseGet()
	{
		self::runCommand(array('phrase', 'get', strtolower(self::getAddon())));
	}
	
	public static function getAddon($new = false)
	{
		$file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'xfcli-addonId';
		
		if ($new)
		{
			file_put_contents($file, 'unitTest' . time());
		}
		
		return file_get_contents($file);
	}
	
	public static function runCommand(array $args, array $flags = array(), array $options = array())
	{
		new CLI_Xf('CLI_Xf', $args, $flags, $options);
	}
	
}<commit_msg>Use manualRun to run test commands<commit_after><?php

require_once dirname(__FILE__) . '/Bootstrap.php';

class Commands extends PHPUnit_Framework_TestCase
{
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__AddonAdd()
	{
		self::runCommand(array('addon', 'add', self::getAddon(true)));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__AddonSelect()
	{
		self::runCommand(array('addon', 'select', self::getAddon()));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__ExtendAdd()
	{
		self::runCommand(array('extend', 'add', 'XenForo_ControllerPublic_Account'));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__ListenerAdd()
	{
		self::runCommand(array('listener', 'add', 'load_class_controller'));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__RouteAdd()
	{
		self::runCommand(array('route', 'add', strtolower(self::getAddon())));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__TemplateAdd()
	{
		self::runCommand(array('template', 'add', strtolower(self::getAddon())));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__PhraseAdd()
	{
		self::runCommand(array('phrase', 'add', strtolower(self::getAddon()), strtolower(self::getAddon()) ));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__PhraseFind()
	{
		self::runCommand(array('phrase', 'find', strtolower(self::getAddon())));
	}
	
	/**
	 * @runInSeparateProcess enabled
	 */
	public function test__PhraseGet()
	{
		self::runCommand(array('phrase', 'get', strtolower(self::getAddon())));
	}
	
	public static function getAddon($new = false)
	{
		$file = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'xfcli-addonId';
		
		if ($new)
		{
			file_put_contents($file, 'unitTest' . time());
		}
		
		return file_get_contents($file);
	}
	
	public static function runCommand(array $args, array $flags = array(), array $options = array())
	{
		$cli = new CLI_Xf(false);
		$cli->manualRun($args, false, $flags, $options);
	}
	
}
{'fraction_non_alphanumeric': 0.16958343603648016, 'fraction_numerical': 0.0, 'mean_word_length': 4.830459770114943, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, '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': '3357928', 'n_tokens_mistral': 1527, 'n_tokens_neox': 1369, 'n_words': 233}