<commit_before><?php
/**
 * ControllerTask Test Case
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.tests.cases.console.libs.tasks
 * @since         CakePHP(tm) v 1.3
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
App::import('Core', 'ClassRegistry');
App::import('View', 'Helper', false);
App::import('Shell', 'Shell', false);

if (!defined('DISABLE_AUTO_DISPATCH')) {
	define('DISABLE_AUTO_DISPATCH', true);
}

if (!class_exists('ShellDispatcher')) {
	ob_start();
	$argv = false;
	require CAKE . 'console' .  DS . 'cake.php';
	ob_end_clean();
}

require_once CAKE . 'console' .  DS . 'libs' . DS . 'tasks' . DS . 'project.php';
require_once CAKE . 'console' .  DS . 'libs' . DS . 'tasks' . DS . 'controller.php';
require_once CAKE . 'console' .  DS . 'libs' . DS . 'tasks' . DS . 'model.php';
require_once CAKE . 'console' .  DS . 'libs' . DS . 'tasks' . DS . 'template.php';
require_once CAKE . 'console' .  DS . 'libs' . DS . 'tasks' . DS . 'test.php';


$imported = App::import('Model', 'Article');
$imported = $imported || App::import('Model', 'Comment');
$imported = $imported || App::import('Model', 'Tag');

if (!$imported) {
	define('ARTICLE_MODEL_CREATED', true);
	App::import('Core', 'Model');

	class Article extends Model {
		public $name = 'Article';
		public $hasMany = array('Comment');
		public $hasAndBelongsToMany = array('Tag');
	}

}

/**
 * ControllerTaskTest class
 *
 * @package       cake
 * @subpackage    cake.tests.cases.console.libs.tasks
 */
class ControllerTaskTest extends CakeTestCase {

/**
 * fixtures
 *
 * @var array
 * @access public
 */
	public $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');

/**
 * startTest method
 *
 * @return void
 */
	public function startTest() {
		$this->Dispatcher = $this->getMock('ShellDispatcher', array(
			'getInput', 'stdout', 'stderr', '_stop', '_initEnvironment'
		));
		$this->Task = $this->getMock('ControllerTask', 
			array('in', 'out', 'err', 'hr', 'createFile', '_stop', '_checkUnitTest'), 
			array(&$this->Dispatcher)
		);
		$this->Task->name = 'ControllerTask';
		$this->Task->Dispatch->shellPaths = App::path('shells');
		$this->Task->Template =& new TemplateTask($this->Task->Dispatch);
		$this->Task->Template->params['theme'] = 'default';

		$this->Task->Model = $this->getMock('ModelTask', array(), array(&$this->Dispatcher));
		$this->Task->Project = $this->getMock('ProjectTask', array(), array(&$this->Dispatcher));
		$this->Task->Test = $this->getMock('TestTask', array(), array(&$this->Dispatcher));
	}

/**
 * endTest method
 *
 * @return void
 */
	public function endTest() {
		unset($this->Task, $this->Dispatcher);
		ClassRegistry::flush();
	}

/**
 * test ListAll
 *
 * @return void
 */
	public function testListAll() {
		$this->Task->connection = 'test_suite';
		$this->Task->interactive = true;
		$this->Task->expects($this->at(1))->method('out')->with('1. Articles');
		$this->Task->expects($this->at(2))->method('out')->with('2. ArticlesTags');
		$this->Task->expects($this->at(3))->method('out')->with('3. Comments');
		$this->Task->expects($this->at(4))->method('out')->with('4. Tags');

		$this->Task->expects($this->at(6))->method('out')->with('1. Articles');
		$this->Task->expects($this->at(7))->method('out')->with('2. ArticlesTags');
		$this->Task->expects($this->at(8))->method('out')->with('4. Comments');
		$this->Task->expects($this->at(9))->method('out')->with('5. Tags');

		$expected = array('Articles', 'ArticlesTags', 'Comments', 'Tags');<commit_msg>First test passing for controllertask test<commit_after><?php
/**
 * ControllerTask Test Case
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.tests.cases.console.libs.tasks
 * @since         CakePHP(tm) v 1.3
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
App::import('Core', 'ClassRegistry');
App::import('View', 'Helper', false);
App::import('Shell', 'Shell', false);

if (!defined('DISABLE_AUTO_DISPATCH')) {
	define('DISABLE_AUTO_DISPATCH', true);
}

if (!class_exists('ShellDispatcher')) {
	ob_start();
	$argv = false;
	require CAKE . 'console' .  DS . 'cake.php';
	ob_end_clean();
}

require_once CAKE . 'console' .  DS . 'libs' . DS . 'tasks' . DS . 'project.php';
require_once CAKE . 'console' .  DS . 'libs' . DS . 'tasks' . DS . 'controller.php';
require_once CAKE . 'console' .  DS . 'libs' . DS . 'tasks' . DS . 'model.php';
require_once CAKE . 'console' .  DS . 'libs' . DS . 'tasks' . DS . 'template.php';
require_once CAKE . 'console' .  DS . 'libs' . DS . 'tasks' . DS . 'test.php';


$imported = App::import('Model', 'Article');
$imported = $imported || App::import('Model', 'Comment');
$imported = $imported || App::import('Model', 'Tag');

if (!$imported) {
	define('ARTICLE_MODEL_CREATED', true);
	App::import('Core', 'Model');

	class Article extends Model {
		public $name = 'Article';
		public $hasMany = array('Comment');
		public $hasAndBelongsToMany = array('Tag');
	}

}

/**
 * ControllerTaskTest class
 *
 * @package       cake
 * @subpackage    cake.tests.cases.console.libs.tasks
 */
class ControllerTaskTest extends CakeTestCase {

/**
 * fixtures
 *
 * @var array
 * @access public
 */
	public $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');

/**
 * startTest method
 *
 * @return void
 */
	public function startTest() {
		$this->Dispatcher = $this->getMock('ShellDispatcher', array(
			'getInput', 'stdout', 'stderr', '_stop', '_initEnvironment'
		));
		$this->Task = $this->getMock('ControllerTask', 
			array('in', 'out', 'err', 'hr', 'createFile', '_stop', '_checkUnitTest'), 
			array(&$this->Dispatcher)
		);
		$this->Task->name = 'ControllerTask';
		$this->Task->Dispatch->shellPaths = App::path('shells');
		$this->Task->Template =& new TemplateTask($this->Task->Dispatch);
		$this->Task->Template->params['theme'] = 'default';

		$this->Task->Model = $this->getMock('ModelTask', 
			array('in', 'out', 'err', 'createFile', '_stop', '_checkUnitTest'), 
			array(&$this->Dispatcher)
		);
		$this->Task->Project = $this->getMock('ProjectTask', 
			array('in', 'out', 'err', 'createFile', '_stop', '_checkUnitTest'), 
			array(&$this->Dispatcher)
		);
		$this->Task->Test = $this->getMock('TestTask', array(), array(&$this->Dispatcher));
	}

/**
 * endTest method
 *
 * @return void
 */
	public function endTest() {
		unset($this->Task, $this->Dispatcher);
		ClassRegistry::flush();
	}

/**
 * test ListAll
 *
 * @return void
 */
	public function testListAll() {
		$this->Task->connection = 'test_suite';
		$this->Task->interactive = true;
		$this->Task->expects($this->at(1))->method('out')->with('1. Articles');
		$this->Task->expects($this->at(2))->method('out')->with('2. ArticlesTags');
		$this->Task->expects($this->at(3))->method('out')->with('3. Comments');
		$this->Task->expects($this->at(4))->method('out')->with('4. Tags');

		$expected = array('Articles', 'ArticlesTags', 'Comments', 'Tags');
{'fraction_non_alphanumeric': 0.212592403772623, 'fraction_numerical': 0.008157022686719348, 'mean_word_length': 4.227848101265823, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 133, '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': '10279', 'n_tokens_mistral': 2784, 'n_tokens_neox': 2605, 'n_words': 538}