Skip to content
Permalink
Browse files

Fixing the rest of the failing tests

  • Loading branch information...
lorenzo committed Aug 29, 2014
1 parent c53b815 commit 5821cde62284391f9449df4a9f93b599c5ef19f7
@@ -16,8 +16,8 @@
use Cake\Controller\ComponentRegistry;
use Cake\Controller\Controller;
use Cake\Core\Error\Exception;
use Cake\Core\InstanceConfigTrait;
use Cake\Error;
use Cake\Network\Request;
use Cake\Utility\Inflector;
@@ -99,7 +99,7 @@ public function __construct(ComponentRegistry $registry, array $config = array()
public function controller(Controller $controller = null) {
if ($controller) {
if (!$controller instanceof Controller) {
throw new Error\Exception('$controller needs to be an instance of Controller');
throw new Exception('$controller needs to be an instance of Controller');
}
$this->_Controller = $controller;
return true;
@@ -15,7 +15,7 @@
namespace Cake\Auth;
use Cake\Controller\Controller;
use Cake\Core\Error;
use Cake\Core\Error\Exception;
use Cake\Network\Request;
/**
@@ -48,7 +48,7 @@ class ControllerAuthorize extends BaseAuthorize {
public function controller(Controller $controller = null) {
if ($controller) {
if (!method_exists($controller, 'isAuthorized')) {
throw new Error\Exception(sprintf('%s does not implement an isAuthorized() method.', get_class($controller)));
throw new Exception(sprintf('%s does not implement an isAuthorized() method.', get_class($controller)));
}
}
return parent::controller($controller);
@@ -16,7 +16,7 @@
use Cake\Cache\CacheEngine;
use Cake\Core\Configure;
use Cake\Error;
use Cake\Core\Error\Exception;
use Cake\Utility\Inflector;
/**
@@ -323,7 +323,7 @@ protected function _clearDirectory($path, $now, $threshold) {
* @throws \Cake\Core\Error\Exception
*/
public function decrement($key, $offset = 1) {
throw new Error\Exception('Files cannot be atomically decremented.');
throw new Exception('Files cannot be atomically decremented.');
}
/**
@@ -335,7 +335,7 @@ public function decrement($key, $offset = 1) {
* @throws \Cake\Core\Error\Exception
*/
public function increment($key, $offset = 1) {
throw new Error\Exception('Files cannot be atomically incremented.');
throw new Exception('Files cannot be atomically incremented.');
}
/**
@@ -15,7 +15,7 @@
namespace Cake\Cache\Engine;
use Cake\Cache\CacheEngine;
use Cake\Error;
use Cake\Core\Error\Exception;
use Cake\Utility\Inflector;
use \Memcached;
@@ -152,7 +152,7 @@ public function init(array $config = []) {
if ($this->_config['login'] !== null && $this->_config['password'] !== null) {
if (!method_exists($this->_Memcached, 'setSaslAuthData')) {
throw new Error\Exception(
throw new Exception(
'Memcached extension is not build with SASL support'
);
}
@@ -173,13 +173,13 @@ protected function _setOptions() {
$serializer = strtolower($this->_config['serialize']);
if (!isset($this->_serializers[$serializer])) {
throw new Error\Exception(
throw new Exception(
sprintf('%s is not a valid serializer engine for Memcached', $serializer)
);
}
if ($serializer !== 'php' && !constant('Memcached::HAVE_' . strtoupper($serializer))) {
throw new Error\Exception(
throw new Exception(
sprintf('Memcached extension is not compiled with %s support', $serializer)
);
}
@@ -19,6 +19,7 @@
use Cake\Controller\Controller;
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Error\Exception;
use Cake\Error;
use Cake\Error\Debugger;
use Cake\Event\Event;
@@ -499,10 +500,10 @@ public function constructAuthorize() {
foreach ($authorize as $class => $config) {
$className = App::className($class, 'Auth', 'Authorize');
if (!class_exists($className)) {
throw new Error\Exception(sprintf('Authorization adapter "%s" was not found.', $class));
throw new Exception(sprintf('Authorization adapter "%s" was not found.', $class));
}
if (!method_exists($className, 'authorize')) {
throw new Error\Exception('Authorization objects must implement an authorize() method.');
throw new Exception('Authorization objects must implement an authorize() method.');
}
$config = (array)$config + $global;
$this->_authorizeObjects[] = new $className($this->_registry, $config);
@@ -761,10 +762,10 @@ public function constructAuthenticate() {
}
$className = App::className($class, 'Auth', 'Authenticate');
if (!class_exists($className)) {
throw new Error\Exception(sprintf('Authentication adapter "%s" was not found.', $class));
throw new Exception(sprintf('Authentication adapter "%s" was not found.', $class));
}
if (!method_exists($className, 'authenticate')) {
throw new Error\Exception('Authentication objects must implement an authenticate() method.');
throw new Exception('Authentication objects must implement an authenticate() method.');
}
$config = array_merge($global, (array)$config);
$this->_authenticateObjects[] = new $className($this->_registry, $config);
@@ -16,7 +16,7 @@
use Cake\Core\Configure\ConfigEngineInterface;
use Cake\Core\Plugin;
use Cake\Error;
use Cake\Core\Error\Exception;
use Cake\Utility\Hash;
/**
@@ -97,12 +97,12 @@ public function __construct($path = null, $section = null) {
*/
public function read($key) {
if (strpos($key, '..') !== false) {
throw new Error\Exception('Cannot load configuration files with ../ in them.');
throw new Exception('Cannot load configuration files with ../ in them.');
}
$file = $this->_getFilePath($key);
if (!is_file($file)) {
throw new Error\Exception(sprintf('Could not load configuration file: %s', $file));
throw new Exception(sprintf('Could not load configuration file: %s', $file));
}
$contents = parse_ini_file($file, true);
@@ -15,8 +15,8 @@
namespace Cake\Core\Configure\Engine;
use Cake\Core\Configure\ConfigEngineInterface;
use Cake\Core\Error\Exception;
use Cake\Core\Plugin;
use Cake\Error;
/**
* PHP engine allows Configure to load configuration values from
@@ -60,17 +60,17 @@ public function __construct($path = null) {
*/
public function read($key) {
if (strpos($key, '..') !== false) {
throw new Error\Exception('Cannot load configuration files with ../ in them.');
throw new Exception('Cannot load configuration files with ../ in them.');
}
$file = $this->_getFilePath($key);
if (!is_file($file)) {
throw new Error\Exception(sprintf('Could not load configuration file: %s', $file));
throw new Exception(sprintf('Could not load configuration file: %s', $file));
}
include $file;
if (!isset($config)) {
throw new Error\Exception(sprintf('No variable $config found in %s', $file));
throw new Exception(sprintf('No variable $config found in %s', $file));
}
return $config;
}
@@ -13,7 +13,7 @@
*/
namespace Cake\Core\Error;
use Exception;
use Cake\Core\Error\Exception;
/**
* Exception raised when a plugin could not be found
@@ -14,8 +14,8 @@
*/
namespace Cake\Database\Type;
use Cake\Core\Error\Exception;
use Cake\Database\Driver;
use Cake\Error;
use PDO;
/**
@@ -57,7 +57,7 @@ public function toPHP($value, Driver $driver) {
if (is_resource($value)) {
return $value;
}
throw new Error\Exception(sprintf('Unable to convert %s into binary.', gettype($value)));
throw new Exception(sprintf('Unable to convert %s into binary.', gettype($value)));
}
/**
@@ -13,6 +13,8 @@
*/
namespace Cake\Error;
use Cake\Core\Error\Exception;
/**
* Represents a fatal error
*
@@ -15,7 +15,7 @@
namespace Cake\Log\Engine;
use Cake\Console\ConsoleOutput;
use Cake\Error;
use Cake\Core\Error\Exception;
/**
* Console logging. Writes logs to console output.
@@ -69,7 +69,7 @@ public function __construct(array $config = array()) {
} elseif (is_string($config['stream'])) {
$this->_output = new ConsoleOutput($config['stream']);
} else {
throw new Error\Exception('`stream` not a ConsoleOutput nor string');
throw new Exception('`stream` not a ConsoleOutput nor string');
}
$this->_output->outputAs($config['outputAs']);
}
@@ -14,7 +14,7 @@
namespace Cake\Log;
use Cake\Core\StaticConfigTrait;
use Cake\Error;
use Cake\Core\Error\Exception;
use Cake\Log\Engine\BaseLog;
/**
@@ -325,7 +325,7 @@ public static function write($level, $message, $scope = array()) {
}
if (!in_array($level, static::$_levels)) {
throw new Error\Exception(sprintf('Invalid log level "%s"', $level));
throw new Exception(sprintf('Invalid log level "%s"', $level));
}
$logged = false;
@@ -15,9 +15,9 @@
namespace Cake\Log;
use Cake\Core\App;
use Cake\Error;
use Cake\Log\LogInterface;
use Cake\Core\Error\Exception;
use Cake\Core\ObjectRegistry;
use Cake\Log\LogInterface;
/**
* Registry of loaded log engines
@@ -51,7 +51,7 @@ protected function _resolveClassName($class) {
* @throws \Cake\Core\Error\Exception
*/
protected function _throwMissingClassError($class, $plugin) {
throw new Error\Exception(sprintf('Could not load class %s', $class));
throw new Exception(sprintf('Could not load class %s', $class));
}
/**
@@ -79,7 +79,7 @@ protected function _create($class, $alias, $settings) {
return $instance;
}
throw new Error\Exception(
throw new Exception(
'Loggers must implement Cake\Log\LogInterface.'
);
}
@@ -13,7 +13,7 @@
*/
namespace Cake\Network\Http\Adapter;
use Cake\Error;
use Cake\Core\Error\Exception;
use Cake\Network\Http\FormData;
use Cake\Network\Http\Request;
use Cake\Network\Http\Response;
@@ -244,7 +244,7 @@ protected function _send(Request $request) {
fclose($this->_stream);
if ($meta['timed_out']) {
throw new Error\Exception('Connection timed out ' . $url);
throw new Exception('Connection timed out ' . $url);
}
$headers = $meta['wrapper_data'];
if (isset($meta['wrapper_type']) && $meta['wrapper_type'] === 'curl') {
@@ -266,7 +266,7 @@ protected function _open($url) {
restore_error_handler();
if (!$this->_stream || !empty($this->_connectionErrors)) {
throw new Error\Exception(implode("\n", $this->_connectionErrors));
throw new Exception(implode("\n", $this->_connectionErrors));
}
}
@@ -13,7 +13,7 @@
*/
namespace Cake\Network\Http\Auth;
use Cake\Error;
use Cake\Core\Error\Exception;
use Cake\Network\Http\Request;
/**
@@ -60,7 +60,7 @@ public function authentication(Request $request, array $credentials) {
break;
default:
throw new Error\Exception(sprintf('Unknown Oauth signature method %s', $credentials['method']));
throw new Exception(sprintf('Unknown Oauth signature method %s', $credentials['method']));
}
$request->header('Authorization', $value);
@@ -166,7 +166,7 @@ public function baseString($request, $oauthValues) {
protected function _normalizedUrl($url) {
$parts = parse_url($url);
if (!$parts) {
throw new Error\Exception('Unable to parse URL');
throw new Exception('Unable to parse URL');
}
$scheme = strtolower($parts['scheme'] ?: 'http');
$defaultPorts = [
@@ -14,8 +14,8 @@
namespace Cake\Network\Http;
use Cake\Core\App;
use Cake\Core\Error\Exception;
use Cake\Core\InstanceConfigTrait;
use Cake\Error;
use Cake\Network\Http\CookieCollection;
use Cake\Network\Http\Request;
use Cake\Utility\Hash;
@@ -411,7 +411,7 @@ protected function _typeHeaders($type) {
'xml' => 'application/xml',
];
if (!isset($typeMap[$type])) {
throw new Error\Exception('Unknown type alias.');
throw new Exception('Unknown type alias.');
}
return [
'Accept' => $typeMap[$type],
@@ -469,7 +469,7 @@ protected function _createAuth($auth, $options) {
$name = ucfirst($auth['type']);
$class = App::className($name, 'Network/Http/Auth');
if (!$class) {
throw new Error\Exception(
throw new Exception(
sprintf('Invalid authentication type %s', $name)
);
}
@@ -13,7 +13,7 @@
*/
namespace Cake\Network\Http;
use Cake\Error;
use Cake\Core\Error\Exception;
use Cake\Network\Http\Message;
/**
@@ -68,7 +68,7 @@ public function method($method = null) {
}
$name = get_called_class() . '::METHOD_' . strtoupper($method);
if (!defined($name)) {
throw new Error\Exception('Invalid method type');
throw new Exception('Invalid method type');
}
$this->_method = $method;
return $this;
Oops, something went wrong.

0 comments on commit 5821cde

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