Browse Source

Merge pull request #5250 from cakephp/3.0-cleanup-testsuite

Remove broken ControllerTestCase
Mark Story 11 years ago
parent
commit
8a5f246426

+ 0 - 425
src/TestSuite/ControllerTestCase.php

@@ -1,425 +0,0 @@
-<?php
-/**
- * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
- * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
- *
- * Licensed under The MIT License
- * For full copyright and license information, please see the LICENSE.txt
- * Redistributions of files must retain the above copyright notice
- *
- * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @since         2.0.0
- * @license       http://www.opensource.org/licenses/mit-license.php MIT License
- */
-namespace Cake\TestSuite;
-
-use Cake\Controller\Exception\MissingComponentException;
-use Cake\Core\App;
-use Cake\Event\Event;
-use Cake\Network\Request;
-use Cake\Network\Session;
-use Cake\Routing\DispatcherFactory;
-use Cake\Routing\DispatcherFilter;
-use Cake\Routing\Exception\MissingControllerException;
-use Cake\Routing\Router;
-use Cake\Utility\Inflector;
-use Cake\View\Helper;
-
-/**
- * StubControllerFilter
- *
- * A test harness dispatcher filter that allows
- * pre-generated controllers to be injected into the dispatch cycle.
- *
- */
-class StubControllerFilter extends DispatcherFilter {
-
-/**
- * Attempts to always run last.
- *
- * @var int
- */
-	protected $_priority = 9999;
-
-/**
- * The controller to use in the dispatch process
- *
- * @var \Cake\Controller\Controller
- */
-	public $testController;
-
-/**
- * Response stub to apply on the controller.
- *
- * @var \Cake\Network\Response
- */
-	public $response;
-
-/**
- * Returns the test controller
- *
- * @param \Cake\Event\Event $event The event object.
- * @return void
- */
-	public function beforeDispatch(Event $event) {
-		if (empty($event->data['controller'])) {
-			return;
-		}
-		if ($this->testController !== null) {
-			$event->data['controller'] = $this->testController;
-		}
-		$request = $event->data['request'];
-		$response = $event->data['response'];
-		$controller = $event->data['controller'];
-
-		$default = array(
-			'InterceptContent' => array(
-				'className' => 'Cake\TestSuite\InterceptContentHelper'
-			)
-		);
-		$controller->helpers = array_merge($default, $controller->helpers);
-		$controller->setRequest($request);
-		$controller->response = $this->response;
-		$registry = $controller->components();
-		foreach ($registry->loaded() as $component) {
-			$object = $registry->{$component};
-			if (isset($object->response)) {
-				$object->response = $response;
-			}
-			if (isset($object->request)) {
-				$object->request = $request;
-			}
-		}
-	}
-
-}
-
-/**
- * InterceptContentHelper class
- *
- */
-class InterceptContentHelper extends Helper {
-
-/**
- * Intercepts and stores the contents of the view before the layout is rendered
- *
- * @param string $viewFile The view file
- * @return void
- */
-	public function afterRender($viewFile) {
-		$this->_View->assign('__view_no_layout__', $this->_View->fetch('content'));
-		$this->_View->helpers()->unload('InterceptContent');
-	}
-
-}
-
-/**
- * ControllerTestCase class
- *
- * @deprecated
- */
-abstract class ControllerTestCase extends TestCase {
-
-/**
- * The controller to test in testAction
- *
- * @var \Cake\Controller\Controller
- */
-	public $controller = null;
-
-/**
- * Automatically mock controllers that aren't mocked
- *
- * @var bool
- */
-	public $autoMock = true;
-
-/**
- * Use custom routes during tests
- *
- * @var bool
- */
-	public $loadRoutes = true;
-
-/**
- * The resulting view vars of the last testAction call
- *
- * @var array
- */
-	public $vars = null;
-
-/**
- * The resulting rendered view of the last testAction call
- *
- * @var string
- */
-	public $view = null;
-
-/**
- * The resulting rendered layout+view of the last testAction call
- *
- * @var string
- */
-	public $contents = null;
-
-/**
- * The returned result of the dispatch (requestAction), if any
- *
- * @var string
- */
-	public $result = null;
-
-/**
- * The headers that would have been sent by the action
- *
- * @var string
- */
-	public $headers = null;
-
-/**
- * Flag for checking if the controller instance is dirty.
- * Once a test has been run on a controller it should be rebuilt
- * to clean up properties.
- *
- * @var bool
- */
-	protected $_dirtyController = false;
-
-/**
- * The default session object to use
- *
- * @var \Cake\Network\Session
- */
-	protected $_session;
-
-/**
- * Used to enable calling ControllerTestCase::testAction() without the testing
- * framework thinking that it's a test case
- *
- * @param string $name The name of the function
- * @param array $arguments Array of arguments
- * @return mixed the return of _testAction
- * @throws \BadMethodCallException when you call methods that don't exist.
- */
-	public function __call($name, $arguments) {
-		if ($name === 'testAction') {
-			return call_user_func_array(array($this, '_testAction'), $arguments);
-		}
-		throw new \BadMethodCallException("Method '{$name}' does not exist.");
-	}
-
-/**
- * Lets you do functional tests of a controller action.
- *
- * ### Options:
- *
- * - `data` The data to use for POST or PUT requests. If `method` is GET
- *   and `query` is empty, the data key will be used as GET parameters. By setting
- *   `data to a string you can simulate XML or JSON payloads allowing you to test
- *   REST webservices.
- * - `query` The query string parameters to set.
- * - `cookies` The cookie data to use for the request.
- * - `method` POST or GET. Defaults to GET.
- * - `return` Specify the return type you want. Choose from:
- *     - `vars` Get the set view variables.
- *     - `view` Get the rendered view, without a layout.
- *     - `contents` Get the rendered view including the layout.
- *     - `result` Get the return value of the controller action. Useful
- *       for testing requestAction methods.
- *
- * @param string $url The url to test
- * @param array $options See options
- * @return mixed
- */
-	protected function _testAction($url = '', $options = array()) {
-		$this->vars = $this->result = $this->view = $this->contents = $this->headers = null;
-		$this->_session = $this->_session ?: new Session();
-
-		$options += array(
-			'query' => array(),
-			'data' => array(),
-			'cookies' => array(),
-			'method' => 'GET',
-			'return' => 'result'
-		);
-
-		$method = strtoupper($options['method']);
-		$_SERVER['REQUEST_METHOD'] = $method;
-
-		if ($method === 'GET' && is_array($options['data']) && empty($options['query'])) {
-			$options['query'] = $options['data'];
-			$options['data'] = array();
-		}
-		$requestData = array(
-			'url' => $url,
-			'cookies' => $options['cookies'],
-			'query' => $options['query'],
-			'session' => $this->_session
-		);
-		if (is_array($options['data'])) {
-			$requestData['post'] = $options['data'];
-		}
-
-		$request = $this->getMock(
-			'Cake\Network\Request',
-			array('_readInput', 'method'),
-			array($requestData)
-		);
-
-		$request->expects($this->any())
-			->method('method')
-			->will($this->returnValue($method));
-
-		if (is_string($options['data'])) {
-			$request->expects($this->any())
-				->method('_readInput')
-				->will($this->returnValue($options['data']));
-		}
-
-		if ($this->loadRoutes) {
-			Router::reload();
-		}
-		$request->addParams(Router::parse($request->url));
-
-		// Handle redirect routes.
-		if (!isset($request->params['controller']) && Router::getRequest()) {
-			$this->headers = Router::getRequest()->response->header();
-			return;
-		}
-
-		$stubFilter = new StubControllerFilter();
-		$dispatch = DispatcherFactory::create();
-		$dispatch->addFilter($stubFilter);
-
-		if ($this->_dirtyController) {
-			$this->controller = null;
-		}
-		if ($this->controller === null && $this->autoMock) {
-			$plugin = '';
-			if (!empty($request->params['plugin'])) {
-				$plugin = $request->params['plugin'] . '.';
-			}
-			$controllerName = $request->params['controller'];
-			if (!empty($request->params['prefix'])) {
-				$controllerName = Inflector::camelize($request->params['prefix']) . '/' . $controllerName;
-			}
-			$this->generate($plugin . $controllerName, [], $request);
-		}
-		$params = array();
-		if ($options['return'] === 'result') {
-			$params['return'] = 1;
-			$params['bare'] = 1;
-			$params['requested'] = 1;
-		}
-		$request->addParams($params);
-
-		$response = $this->getMock('Cake\Network\Response', array('send', 'stop'));
-		$stubFilter->response = $response;
-		$stubFilter->testController = $this->controller;
-		$this->result = $dispatch->dispatch($request, $response);
-
-		$this->controller = $stubFilter->testController;
-		$this->vars = $this->controller->viewVars;
-		$this->contents = $this->controller->response->body();
-		if (isset($this->controller->View)) {
-			$this->view = $this->controller->View->fetch('__view_no_layout__');
-		}
-		$this->_dirtyController = true;
-		$this->headers = $response->header();
-
-		return $this->{$options['return']};
-	}
-
-/**
- * Generates a mocked controller and mocks any classes passed to `$mocks`.
- *
- * ### Mocks:
- *
- * - `methods` Methods to mock on the controller.
- * - `models` Models to mock. Models are added to the ClassRegistry so any
- *   time they are instantiated the mock will be created. Pass as key value pairs
- *   with the value being specific methods on the model to mock. If `true` or
- *   no value is passed, the entire model will be mocked.
- * - `components` Components to mock. Components are only mocked on this controller
- *   and not within each other (i.e., components on components)
- *
- * @param string $controller Controller name
- * @param array $mocks List of classes and methods to mock
- * @param \Cake\Network\Request|null $request A request object to build the controller with.
- *   This parameter is required when mocking prefixed controllers.
- * @return \Cake\Controller\Controller Mocked controller
- * @throws \Cake\Routing\Exception\MissingControllerException When controllers could not be created.
- * @throws \Cake\Controller\Exception\MissingComponentException When components could not be created.
- */
-	public function generate($controller, array $mocks = array(), Request $request = null) {
-		$className = App::className($controller, 'Controller', 'Controller');
-		if (!$className) {
-			list($plugin, $controller) = pluginSplit($controller);
-			throw new MissingControllerException(array(
-				'class' => $controller . 'Controller',
-				'plugin' => $plugin
-			));
-		}
-
-		$mocks += [
-			'methods' => null,
-			'models' => [],
-			'components' => []
-		];
-		list(, $controllerName) = namespaceSplit($className);
-		$name = substr($controllerName, 0, -10);
-
-		$this->_session = $this->_session ?: new Session();
-		$request = $request ?: $this->getMock(
-			'Cake\Network\Request',
-			['_readInput', 'method'],
-			[['session' => $this->_session]]
-		);
-
-		$response = $this->getMock('Cake\Network\Response', array('_sendHeader', 'stop'));
-		$controller = $this->getMock(
-			$className,
-			$mocks['methods'],
-			array($request, $response, $name)
-		);
-
-		foreach ($mocks['models'] as $model => $methods) {
-			if (is_string($methods)) {
-				$model = $methods;
-				$methods = true;
-			}
-			if ($methods === true) {
-				$methods = array();
-			}
-			$this->getMockForModel($model, $methods);
-		}
-
-		foreach ($mocks['components'] as $component => $methods) {
-			if (is_string($methods)) {
-				$component = $methods;
-				$methods = true;
-			}
-			if ($methods === true) {
-				$methods = array();
-			}
-			$componentClass = App::className($component, 'Controller/Component', 'Component');
-			list(, $name) = pluginSplit($component, true);
-			if (!$componentClass) {
-				throw new MissingComponentException(array(
-					'class' => $name . 'Component'
-				));
-			}
-			$registry = $controller->components();
-
-			$config = isset($controller->components[$component]) ? $controller->components[$component] : array();
-			$component = $this->getMock($componentClass, $methods, array($registry, $config));
-			$registry->set($name, $component);
-			$controller->{$name} = $component;
-		}
-
-		$this->_dirtyController = false;
-		$this->controller = $controller;
-		return $this->controller;
-	}
-
-}

+ 0 - 523
tests/TestCase/TestSuite/ControllerTestCaseTest.php

@@ -1,523 +0,0 @@
-<?php
-/**
- * CakePHP : Rapid Development Framework (http://cakephp.org)
- * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
- *
- * Licensed under The MIT License
- * For full copyright and license information, please see the LICENSE.txt
- * Redistributions of files must retain the above copyright notice.
- *
- * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link          http://cakephp.org CakePHP Project
- * @since         2.0.0
- * @license       http://www.opensource.org/licenses/mit-license.php MIT License
- */
-namespace Cake\Test\TestCase\TestSuite;
-
-use Cake\Controller\Controller;
-use Cake\Core\App;
-use Cake\Core\Configure;
-use Cake\Core\Plugin;
-use Cake\ORM\Table;
-use Cake\ORM\TableRegistry;
-use Cake\Routing\DispatcherFactory;
-use Cake\Routing\Router;
-use Cake\TestSuite\Reporter\HtmlReporter;
-use Cake\TestSuite\TestCase;
-
-/**
- * ControllerTestCaseTest
- *
- */
-class ControllerTestCaseTest extends TestCase {
-
-/**
- * fixtures property
- *
- * @var array
- */
-	public $fixtures = array('core.posts', 'core.authors', 'core.test_plugin_comments');
-
-/**
- * reset environment.
- *
- * @return void
- */
-	public function setUp() {
-		parent::setUp();
-		Configure::write('App.namespace', 'TestApp');
-		Plugin::load(array('TestPlugin', 'TestPluginTwo'));
-
-		$this->Case = $this->getMockForAbstractClass('Cake\TestSuite\ControllerTestCase');
-		$this->Case->loadRoutes = false;
-
-		DispatcherFactory::add('Routing');
-		DispatcherFactory::add('ControllerFactory');
-		Router::scope('/', function ($routes) {
-			$routes->fallbacks();
-		});
-		Router::prefix('admin', function ($routes) {
-			$routes->plugin('TestPlugin', function ($routes) {
-				$routes->fallbacks();
-			});
-			$routes->fallbacks();
-		});
-		Router::plugin('TestPlugin', function ($routes) {
-			$routes->fallbacks();
-		});
-		Router::plugin('TestPluginTwo', function ($routes) {
-			$routes->fallbacks();
-		});
-		TableRegistry::clear();
-	}
-
-/**
- * tearDown
- *
- * @return void
- */
-	public function tearDown() {
-		parent::tearDown();
-		Plugin::unload();
-		DispatcherFactory::clear();
-		$this->Case->controller = null;
-	}
-
-/**
- * Test that ControllerTestCase::generate() creates mock objects correctly
- *
- * @return void
- */
-	public function testGenerate() {
-		$Posts = $this->Case->generate('TestApp\Controller\PostsController');
-		$this->assertEquals('Posts', $Posts->name);
-		$this->assertEquals('Posts', $Posts->modelClass);
-		$this->assertEquals('Posts', $Posts->viewPath);
-		$this->assertNull($Posts->response->send());
-
-		$Posts = $this->Case->generate('TestApp\Controller\PostsController', array(
-			'methods' => array(
-				'render'
-			)
-		));
-		$this->assertNull($Posts->render('index'));
-
-		$Posts = $this->Case->generate('TestApp\Controller\PostsController', array(
-			'models' => array('Posts'),
-			'components' => array('RequestHandler')
-		));
-
-		$this->assertInstanceOf('TestApp\Model\Table\PostsTable', $Posts->Posts);
-		$this->assertInstanceOf('PHPUnit_Framework_MockObject_MockObject', $Posts->Posts);
-		$this->assertNull($Posts->Posts->deleteAll(array()));
-		$this->assertNull($Posts->Posts->find('all'));
-		$this->assertNull($Posts->RequestHandler->isXml());
-
-		$Posts = $this->Case->generate('TestApp\Controller\PostsController', array(
-			'models' => array(
-				'Posts' => true
-			)
-		));
-		$this->assertNull($Posts->Posts->deleteAll([]));
-		$this->assertNull($Posts->Posts->find('all'));
-
-		$Posts = $this->Case->generate('TestApp\Controller\PostsController', array(
-			'models' => array(
-				'Posts' => array('deleteAll'),
-			)
-		));
-		$this->assertNull($Posts->Posts->deleteAll([]));
-		$this->assertEquals('posts', $Posts->Posts->table());
-
-		$Posts = $this->Case->generate('TestApp\Controller\PostsController', array(
-			'models' => array('Posts'),
-			'components' => array(
-				'RequestHandler' => array('isPut'),
-			)
-		));
-		$Posts->RequestHandler->expects($this->once())
-			->method('isPut')
-			->will($this->returnValue(true));
-		$this->assertTrue($Posts->RequestHandler->isPut());
-	}
-
-/**
- * testGenerateWithComponentConfig
- *
- * @return void
- */
-	public function testGenerateWithComponentConfig() {
-		$Tests = $this->Case->generate('TestConfigs', array(
-		));
-
-		$expected = array('some' => 'config');
-		$settings = array_intersect_key($Tests->RequestHandler->config(), array('some' => 'foo'));
-		$this->assertSame($expected, $settings, 'A mocked component should have the same config as an unmocked component');
-
-		$Tests = $this->Case->generate('TestConfigs', array(
-			'components' => array(
-				'RequestHandler' => array('isPut')
-			)
-		));
-
-		$expected = array('some' => 'config');
-		$settings = array_intersect_key($Tests->RequestHandler->config(), array('some' => 'foo'));
-		$this->assertSame($expected, $settings, 'A mocked component should have the same config as an unmocked component');
-	}
-
-/**
- * Tests ControllerTestCase::generate() using classes from plugins
- *
- * @return void
- */
-	public function testGenerateWithPlugin() {
-		$Tests = $this->Case->generate('TestPlugin.Tests', array(
-			'models' => array(
-				'TestPlugin.TestPluginComments'
-			),
-			'components' => array(
-				'TestPlugin.Plugins'
-			)
-		));
-		$this->assertEquals('Tests', $Tests->name);
-		$this->assertInstanceOf('TestPlugin\Controller\Component\PluginsComponent', $Tests->Plugins);
-		$this->assertInstanceOf('PHPUnit_Framework_MockObject_MockObject', $Tests->Plugins);
-
-		$result = TableRegistry::get('TestPlugin.TestPluginComments');
-		$this->assertInstanceOf('TestPlugin\Model\Table\TestPluginCommentsTable', $result);
-		$this->assertInstanceOf('PHPUnit_Framework_MockObject_MockObject', $result);
-	}
-
-/**
- * Tests testAction
- *
- * @return void
- */
-	public function testTestAction() {
-		$Controller = $this->Case->generate('TestsApps');
-		$this->Case->testAction('/tests_apps/index');
-		$this->assertInternalType('array', $this->Case->controller->viewVars);
-
-		$this->Case->testAction('/tests_apps/set_action');
-		$results = $this->Case->controller->viewVars;
-		$expected = array(
-			'var' => 'string'
-		);
-		$this->assertEquals($expected, $results);
-
-		$result = $this->Case->controller->response->body();
-		$this->assertRegExp('/This is the TestsAppsController index view/', $result);
-
-		$Controller = $this->Case->generate('TestsApps');
-		$this->Case->testAction('/tests_apps/redirect_to');
-		$results = $this->Case->headers;
-		$expected = array(
-			'Location' => 'http://cakephp.org'
-		);
-		$this->assertEquals($expected, $results);
-	}
-
-/**
- * Tests testAction with call to request::method()
- *
- * @return void
- */
-	public function testTestActionWithRequestMethod() {
-		$Controller = $this->Case->generate('TestsApps');
-		$this->Case->testAction('/tests_apps/index', [
-			'method' => 'get'
-		]);
-		$this->assertSame('GET', $this->Case->controller->request->method());
-
-		$this->Case->testAction('/tests_apps/set_action', [
-			'method' => 'post'
-		]);
-		$this->assertSame('POST', $this->Case->controller->request->method());
-	}
-
-/**
- * Test testAction() with prefix routes.
- *
- * @return void
- */
-	public function testActionWithPrefix() {
-		$result = $this->Case->testAction('/admin/posts/index', ['return' => 'view']);
-		$expected = '<h1>Admin Post Index</h1>';
-		$this->assertContains($expected, $result);
-
-		$result = $this->Case->testAction('/admin/test_plugin/comments/index', ['return' => 'view']);
-		$expected = '<h1>TestPlugin Admin Comments</h1>';
-		$this->assertContains($expected, $result);
-	}
-
-/**
- * Make sure testAction() can hit plugin controllers.
- *
- * @return void
- */
-	public function testTestActionWithPlugin() {
-		$this->Case->generate('TestPlugin.Tests');
-		$this->Case->testAction('/test_plugin/tests/index');
-		$this->assertEquals('It is a variable', $this->Case->controller->viewVars['test_value']);
-	}
-
-/**
- * Tests not using loaded routes during tests
- *
- * @expectedException \Cake\Controller\Exception\MissingActionException
- * @return void
- */
-	public function testSkipRoutes() {
-		$this->Case->loadRoutes = false;
-		$this->Case->testAction('/tests_apps/missing_action.json', array('return' => 'view'));
-	}
-
-/**
- * Tests backwards compatibility with setting the return type
- *
- * @return void
- */
-	public function testBCSetReturn() {
-		$this->Case->autoMock = true;
-
-		$result = $this->Case->testAction('/tests_apps/some_method');
-		$this->assertEquals(5, $result);
-
-		$data = array('var' => 'set');
-		$result = $this->Case->testAction('/tests_apps_posts/post_var', array(
-			'method' => 'post',
-			'data' => $data,
-			'return' => 'vars'
-		));
-		$this->assertEquals($data, $result['data']);
-
-		$result = $this->Case->testAction('/tests_apps/set_action', array(
-			'return' => 'view'
-		));
-		$this->assertEquals('This is the TestsAppsController index view string', $result);
-
-		$result = $this->Case->testAction('/tests_apps/set_action', array(
-			'return' => 'contents'
-		));
-		$this->assertRegExp('/<html/', $result);
-		$this->assertRegExp('/This is the TestsAppsController index view/', $result);
-		$this->assertRegExp('/<\/html>/', $result);
-	}
-
-/**
- * Tests sending POST data to testAction
- *
- * @return void
- */
-	public function testTestActionPostData() {
-		$this->Case->autoMock = true;
-
-		$data = array(
-			'name' => 'Some Post'
-		);
-		$this->Case->testAction('/tests_apps_posts/post_var', array(
-			'method' => 'post',
-			'data' => $data
-		));
-		$this->assertEquals($this->Case->controller->viewVars['data'], $data);
-		$this->assertEquals($this->Case->controller->request->data, $data);
-
-		$result = $this->Case->testAction('/tests_apps_posts/post_var', array(
-			'return' => 'vars',
-			'method' => 'post',
-			'data' => array(
-				'name' => 'is jonas',
-				'pork' => 'and beans',
-			)
-		));
-		$this->assertEquals(array('name', 'pork'), array_keys($result['data']));
-
-		$result = $this->Case->testAction('/tests_apps_posts/add', array(
-			'method' => 'post',
-			'return' => 'vars'
-		));
-		$this->assertTrue(array_key_exists('posts', $result));
-		$this->assertInstanceOf('Cake\ORM\Query', $result['posts']);
-		$this->assertTrue($this->Case->controller->request->is('post'));
-	}
-
-/**
- * Tests sending GET data to testAction
- *
- * @return void
- */
-	public function testTestActionGetData() {
-		$this->Case->autoMock = true;
-
-		$result = $this->Case->testAction('/tests_apps_posts/url_var', array(
-			'method' => 'get',
-			'data' => array(
-				'some' => 'var',
-				'lackof' => 'creativity'
-			)
-		));
-		$this->assertEquals('var', $this->Case->controller->request->query['some']);
-		$this->assertEquals('creativity', $this->Case->controller->request->query['lackof']);
-
-		$result = $this->Case->testAction('/tests_apps_posts/url_var/gogo/val2', array(
-			'return' => 'vars',
-			'method' => 'get',
-		));
-		$this->assertEquals(array('gogo', 'val2'), $result['params']['pass']);
-
-		$result = $this->Case->testAction('/tests_apps_posts/url_var', array(
-			'return' => 'vars',
-			'method' => 'get',
-			'data' => array(
-				'red' => 'health',
-				'blue' => 'mana'
-			)
-		));
-		$query = $this->Case->controller->request->query;
-		$this->assertTrue(isset($query['red']));
-		$this->assertTrue(isset($query['blue']));
-	}
-
-/**
- * Test that REST actions with XML/JSON input work.
- *
- * @return void
- */
-	public function testTestActionJsonData() {
-		$result = $this->Case->testAction('/tests_apps_posts/input_data', array(
-			'return' => 'vars',
-			'method' => 'post',
-			'data' => '{"key":"value","json":true}'
-		));
-		$this->assertEquals('value', $result['data']['key']);
-		$this->assertTrue($result['data']['json']);
-	}
-
-/**
- * Tests autoMock ability
- *
- * @return void
- */
-	public function testAutoMock() {
-		$this->Case->autoMock = true;
-		$this->Case->testAction('/tests_apps/set_action');
-		$results = $this->Case->controller->viewVars;
-		$expected = array(
-			'var' => 'string'
-		);
-		$this->assertEquals($expected, $results);
-	}
-
-/**
- * Test using testAction and not mocking
- *
- * @return void
- */
-	public function testNoMocking() {
-		$result = $this->Case->testAction('/tests_apps/some_method');
-		$this->Case->assertEquals(5, $result);
-
-		$data = array('var' => 'set');
-		$result = $this->Case->testAction('/tests_apps_posts/post_var', array(
-			'method' => 'post',
-			'data' => $data,
-			'return' => 'vars'
-		));
-		$this->assertEquals($data, $result['data']);
-
-		$result = $this->Case->testAction('/tests_apps/set_action', array(
-			'return' => 'view'
-		));
-		$this->assertEquals('This is the TestsAppsController index view string', $result);
-
-		$result = $this->Case->testAction('/tests_apps/set_action', array(
-			'return' => 'contents'
-		));
-		$this->assertRegExp('/<html/', $result);
-		$this->assertRegExp('/This is the TestsAppsController index view/', $result);
-		$this->assertRegExp('/<\/html>/', $result);
-	}
-
-/**
- * Test that controllers don't get reused.
- *
- * @return void
- */
-	public function testNoControllerReuse() {
-		$this->Case->autoMock = true;
-		$result = $this->Case->testAction('/tests_apps/index', array(
-			'data' => array('var' => 'first call'),
-			'method' => 'get',
-			'return' => 'contents',
-		));
-		$this->assertContains('<html', $result);
-		$this->assertContains('This is the TestsAppsController index view', $result);
-		$this->assertContains('first call', $result);
-		$this->assertContains('</html>', $result);
-
-		$result = $this->Case->testAction('/tests_apps/index', array(
-			'data' => array('var' => 'second call'),
-			'method' => 'get',
-			'return' => 'contents'
-		));
-		$this->assertContains('second call', $result);
-
-		$result = $this->Case->testAction('/tests_apps/index', array(
-			'data' => array('var' => 'third call'),
-			'method' => 'get',
-			'return' => 'contents'
-		));
-		$this->assertContains('third call', $result);
-	}
-
-/**
- * Test that multiple calls to redirect in the same test method don't cause issues.
- * - Asserting true, to avoid test to be shown as "Risky".
- *
- * @return void
- */
-	public function testTestActionWithMultipleRedirect() {
-		$this->Case->generate('TestsApps');
-
-		$options = array('method' => 'get');
-		$this->Case->testAction('/tests_apps/redirect_to', $options);
-		$this->Case->testAction('/tests_apps/redirect_to', $options);
-
-		$this->assertTrue(true);
-	}
-
-/**
- * Tests that Components storing response or request objects internally during construct
- * will always have a fresh reference to those object available
- *
- * @return void
- * @see https://cakephp.lighthouseapp.com/projects/42648-cakephp/tickets/2705-requesthandler-weird-behavior
- */
-	public function testComponentsSameRequestAndResponse() {
-		$this->Case->generate('TestsApps');
-		$options = array('method' => 'get');
-		$this->Case->testAction('/tests_apps/index', $options);
-		$this->assertSame($this->Case->controller->response, $this->Case->controller->RequestHandler->response);
-		$this->assertSame($this->Case->controller->request, $this->Case->controller->RequestHandler->request);
-	}
-
-/**
- * Test that testAction() doesn't destroy data in GET & POST
- *
- * @return void
- */
-	public function testRestoreGetPost() {
-		$restored = array('new' => 'value');
-
-		$_GET = $restored;
-		$_POST = $restored;
-
-		$this->Case->generate('TestsApps');
-		$options = array('method' => 'get');
-		$this->Case->testAction('/tests_apps/index', $options);
-
-		$this->assertEquals($restored, $_GET);
-		$this->assertEquals($restored, $_POST);
-	}
-
-}