Skip to content
Permalink
Browse files

Fixing some errors from namespace changes.

  • Loading branch information...
jrbasso committed Sep 9, 2012
1 parent 77cf044 commit 617f171f2da1e8796eefa0931b540cdde53ccaaf
@@ -21,6 +21,7 @@
use Cake\Controller\Controller;
use Cake\Controller\ComponentCollection;
use Cake\Controller\Component\AclComponent;
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Utility\Hash;
@@ -72,9 +73,8 @@ public function startup() {
}
$class = Configure::read('Acl.classname');
list($plugin, $class) = pluginSplit($class, true);
App::uses($class, $plugin . 'Controller/Component/Acl');
if (!in_array($class, array('DbAcl', 'DB_ACL')) && !is_subclass_of($class, 'DbAcl')) {
$className = App::classname($class, 'Controller/Component/Acl');
if (!in_array($class, array('DbAcl', 'DB_ACL')) && !is_subclass_of($className, 'Cake\Controller\Component\Acl\DbAcl')) {
$out = "--------------------------------------------------\n";
$out .= __d('cake_console', 'Error: Your current Cake configuration is set to an ACL implementation other than DB.') . "\n";
$out .= __d('cake_console', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n";
@@ -96,7 +96,7 @@ public static function instance($manager = null) {
* when the listener is called. If $called is an instance of Cake\Event\EventListener, this parameter will be ignored
*
* @return void
* @throws Cake\Error\InvalidArgumentException When event key is missing or callable is not an
* @throws InvalidArgumentException When event key is missing or callable is not an
* instance of Cake\Event\EventListener.
*/
public function attach($callable, $eventKey = null, $options = array()) {
@@ -310,13 +310,13 @@ public function reset($state = null) {
* @param string $clientOrServer can be one of 'client', 'server'. Default is 'client'
* @param boolean $enable enable or disable encryption. Default is true (enable)
* @return boolean True on success
* @throws Cake\Error\InvalidArgumentException When an invalid encryption scheme is chosen.
* @throws Cake\Error\SocketException When attempting to enable SSL/TLS fails
* @throws InvalidArgumentException When an invalid encryption scheme is chosen.
* @throws SocketException When attempting to enable SSL/TLS fails
* @see stream_socket_enable_crypto
*/
public function enableCrypto($type, $clientOrServer = 'client', $enable = true) {
if (!array_key_exists($type . '_' . $clientOrServer, $this->_encryptMethods)) {
throw new Error\InvalidArgumentException(__d('cake_dev', 'Invalid encryption scheme chosen'));
throw new \InvalidArgumentException(__d('cake_dev', 'Invalid encryption scheme chosen'));
}
$enableCryptoResult = false;
try {
@@ -22,6 +22,7 @@
use Cake\Console\Shell;
use Cake\Core\App;
use Cake\Core\Plugin;
use Cake\Log\Log;
use Cake\TestSuite\TestCase;
use Cake\Utility\Folder;
use Cake\Utility\Hash;
@@ -21,6 +21,28 @@
use Cake\TestSuite\TestCase;
use Cake\Utility\Xml;
class TestRequest extends Request {
public function reConstruct($url = 'some/path', $parseEnvironment = true) {
$this->_base();
if (empty($url)) {
$url = $this->_url();
}
if ($url[0] == '/') {
$url = substr($url, 1);
}
$this->url = $url;
if ($parseEnvironment) {
$this->_processPost();
$this->_processGet();
$this->_processFiles();
}
$this->here = $this->base . '/' . $this->url;
}
}

This comment has been minimized.

Copy link
@markstory

markstory Sep 10, 2012

Member

I'm pretty sure reConstruct() isn't needed anymore, I'll take a look at the tests and update them.

This comment has been minimized.

Copy link
@jrbasso

jrbasso Sep 10, 2012

Author Member

Cool. I added because there is a test requiring it (few lines below in this diff).

This comment has been minimized.

Copy link
@markstory

markstory Sep 11, 2012

Member

Its required in 2.x but not in 3.x, I'll update the tests :)

class RequestTest extends TestCase {
/**
@@ -224,7 +246,7 @@ public function testPutParsingJSON() {
$_SERVER['REQUEST_METHOD'] = 'PUT';
$_SERVER['CONTENT_TYPE'] = 'application/json';
$request = $this->getMock('TestCakeRequest', array('_readInput'));
$request = $this->getMock(__NAMESPACE__ . '\TestRequest', array('_readInput'));
$request->expects($this->at(0))->method('_readInput')
->will($this->returnValue('{Article":["title"]}'));
$request->reConstruct();
@@ -260,7 +260,7 @@ protected function _connectSocketToSslTls() {
/**
* testEnableCryptoBadMode
*
* @expectedException Cake\Error\InvalidArgumentException
* @expectedException InvalidArgumentException
* @return void
*/
public function testEnableCryptoBadMode() {
@@ -17,6 +17,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace Cake\Test\TestCase\Utility;
use Cake\Core\Configure;
use Cake\TestSuite\TestCase;
use Cake\Utility\String;
@@ -258,8 +258,8 @@ protected function _testAction($url = '', $options = array()) {
$Dispatch = new ControllerTestDispatcher();
$Dispatch->loadRoutes = $this->loadRoutes;
$Dispatch->parseParams(new Event('ControllerTestCase', $Dispatch, array('request' => $request)));
if (!isset($request->params['controller']) && Router::currentRoute()) {
$this->headers = Router::currentRoute()->response->header();
if (!isset($request->params['controller']) && Router::getRequest()) {
$this->headers = Router::getRequest()->response->header();
return;
}
if ($this->__dirtyController) {

0 comments on commit 617f171

Please sign in to comment.
You can’t perform that action at this time.