Skip to content

Commit

Permalink
Fixing some errors from namespace changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Sep 9, 2012
1 parent 77cf044 commit 617f171
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/Cake/Console/Command/AclShell.php
Expand Up @@ -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;

Expand Down Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Event/EventManager.php
Expand Up @@ -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()) {
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Network/Socket.php
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Test/TestCase/Console/ShellTest.php
Expand Up @@ -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;
Expand Down
24 changes: 23 additions & 1 deletion lib/Cake/Test/TestCase/Network/RequestTest.php
Expand Up @@ -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 {

/**
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/TestCase/Network/SocketTest.php
Expand Up @@ -260,7 +260,7 @@ protected function _connectSocketToSslTls() {
/**
* testEnableCryptoBadMode
*
* @expectedException Cake\Error\InvalidArgumentException
* @expectedException InvalidArgumentException
* @return void
*/
public function testEnableCryptoBadMode() {
Expand Down
1 change: 1 addition & 0 deletions lib/Cake/Test/TestCase/Utility/StringTest.php
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/TestSuite/ControllerTestCase.php
Expand Up @@ -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) {
Expand Down

0 comments on commit 617f171

Please sign in to comment.