Merge branch '1.3-lib_renames' into 1.3

This commit is contained in:
gwoo 2009-06-02 10:17:02 -07:00
commit 6f21c18366
19 changed files with 1000 additions and 114 deletions

View file

@ -26,7 +26,7 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('File');
App::import('Model', 'Schema');
App::import('Model', 'CakeSchema');
/**
* Schema is a command-line database management utility for automating programmer chores.
*

View file

@ -832,7 +832,7 @@ class ModelTask extends Shell {
*/
function fixture($model, $useTable = null) {
if (!class_exists('CakeSchema')) {
App::import('Model', 'Schema');
App::import('Model', 'CakeSchema');
}
$out = "\nclass {$model}Fixture extends CakeTestFixture {\n";
$out .= "\tvar \$name = '$model';\n";

778
cake/libs/cake_session.php Normal file
View file

@ -0,0 +1,778 @@
<?php
/* SVN FILE: $Id$ */
/**
* Session class for Cake.
*
* Cake abstracts the handling of sessions.
* There are several convenient methods to access session information.
* This class is the implementation of those methods.
* They are mostly used by the Session Component.
*
* PHP versions 4 and 5
*
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
* @package cake
* @subpackage cake.cake.libs
* @since CakePHP(tm) v .0.10.0.1222
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Database name for cake sessions.
*
*/
if (!class_exists('Set')) {
require LIBS . 'set.php';
}
if (!class_exists('Security')) {
require LIBS . 'security.php';
}
/**
* Session class for Cake.
*
* Cake abstracts the handling of sessions. There are several convenient methods to access session information.
* This class is the implementation of those methods. They are mostly used by the Session Component.
*
* @package cake
* @subpackage cake.cake.libs
*/
class CakeSession extends Object {
/**
* True if the Session is still valid
*
* @var boolean
* @access public
*/
var $valid = false;
/**
* Error messages for this session
*
* @var array
* @access public
*/
var $error = false;
/**
* User agent string
*
* @var string
* @access protected
*/
var $_userAgent = '';
/**
* Path to where the session is active.
*
* @var string
* @access public
*/
var $path = '/';
/**
* Error number of last occurred error
*
* @var integer
* @access public
*/
var $lastError = null;
/**
* 'Security.level' setting, "high", "medium", or "low".
*
* @var string
* @access public
*/
var $security = null;
/**
* Start time for this session.
*
* @var integer
* @access public
*/
var $time = false;
/**
* Time when this session becomes invalid.
*
* @var integer
* @access public
*/
var $sessionTime = false;
/**
* Keeps track of keys to watch for writes on
*
* @var array
* @access public
*/
var $watchKeys = array();
/**
* Current Session id
*
* @var string
* @access public
*/
var $id = null;
/**
* Constructor.
*
* @param string $base The base path for the Session
* @param boolean $start Should session be started right now
* @access public
*/
function __construct($base = null, $start = true) {
if (Configure::read('Session.save') === 'database' && !class_exists('ConnectionManager')) {
App::import('Core', 'ConnectionManager');
}
if (Configure::read('Session.checkAgent') === true || Configure::read('Session.checkAgent') === null) {
if (env('HTTP_USER_AGENT') != null) {
$this->_userAgent = md5(env('HTTP_USER_AGENT') . Configure::read('Security.salt'));
}
}
$this->time = time();
if ($start === true) {
$this->host = env('HTTP_HOST');
if (empty($base) || strpos($base, '?') === 0 || strpos($base, 'index.php') === 0) {
$this->path = '/';
} else {
$this->path = $base;
}
if (strpos($this->host, ':') !== false) {
$this->host = substr($this->host, 0, strpos($this->host, ':'));
}
if (!class_exists('Security')) {
App::import('Core', 'Security');
}
$this->sessionTime = $this->time + (Security::inactiveMins() * Configure::read('Session.timeout'));
$this->security = Configure::read('Security.level');
}
parent::__construct();
}
/**
* Starts the Session.
*
* @param string $name Variable name to check for
* @return boolean True if variable is there
* @access public
*/
function start() {
if (function_exists('session_write_close')) {
session_write_close();
}
$this->__initSession();
return $this->__startSession();
}
/**
* Determine if Session has been started.
*
* @access public
* @return boolean True if session has been started.
*/
function started() {
if (isset($_SESSION)) {
return true;
}
return false;
}
/**
* Returns true if given variable is set in session.
*
* @param string $name Variable name to check for
* @return boolean True if variable is there
* @access public
*/
function check($name) {
$var = $this->__validateKeys($name);
if (empty($var)) {
return false;
}
$result = Set::extract($_SESSION, $var);
return isset($result);
}
/**
* Returns the Session id
*
* @param id $name string
* @return string Session id
* @access public
*/
function id($id = null) {
if ($id) {
$this->id = $id;
session_id($this->id);
}
if (isset($_SESSION)) {
return session_id();
} else {
return $this->id;
}
}
/**
* Removes a variable from session.
*
* @param string $name Session variable to remove
* @return boolean Success
* @access public
*/
function del($name) {
if ($this->check($name)) {
if ($var = $this->__validateKeys($name)) {
if (in_array($var, $this->watchKeys)) {
trigger_error('Deleting session key {' . $var . '}', E_USER_NOTICE);
}
$this->__overwrite($_SESSION, Set::remove($_SESSION, $var));
return ($this->check($var) == false);
}
}
$this->__setError(2, "$name doesn't exist");
return false;
}
/**
* Used to write new data to _SESSION, since PHP doesn't like us setting the _SESSION var itself
*
* @param array $old Set of old variables => values
* @param array $new New set of variable => value
* @access private
*/
function __overwrite(&$old, $new) {
if (!empty($old)) {
foreach ($old as $key => $var) {
if (!isset($new[$key])) {
unset($old[$key]);
}
}
}
foreach ($new as $key => $var) {
$old[$key] = $var;
}
}
/**
* Return error description for given error number.
*
* @param integer $errorNumber Error to set
* @return string Error as string
* @access private
*/
function __error($errorNumber) {
if (!is_array($this->error) || !array_key_exists($errorNumber, $this->error)) {
return false;
} else {
return $this->error[$errorNumber];
}
}
/**
* Returns last occurred error as a string, if any.
*
* @return mixed Error description as a string, or false.
* @access public
*/
function error() {
if ($this->lastError) {
return $this->__error($this->lastError);
} else {
return false;
}
}
/**
* Returns true if session is valid.
*
* @return boolean Success
* @access public
*/
function valid() {
if ($this->read('Config')) {
if ((Configure::read('Session.checkAgent') === false || $this->_userAgent == $this->read('Config.userAgent')) && $this->time <= $this->read('Config.time')) {
if ($this->error === false) {
$this->valid = true;
}
} else {
$this->valid = false;
$this->__setError(1, 'Session Highjacking Attempted !!!');
}
}
return $this->valid;
}
/**
* Returns given session variable, or all of them, if no parameters given.
*
* @param mixed $name The name of the session variable (or a path as sent to Set.extract)
* @return mixed The value of the session variable
* @access public
*/
function read($name = null) {
if (is_null($name)) {
return $this->__returnSessionVars();
}
if (empty($name)) {
return false;
}
$result = Set::extract($_SESSION, $name);
if (!is_null($result)) {
return $result;
}
$this->__setError(2, "$name doesn't exist");
return null;
}
/**
* Returns all session variables.
*
* @return mixed Full $_SESSION array, or false on error.
* @access private
*/
function __returnSessionVars() {
if (!empty($_SESSION)) {
return $_SESSION;
}
$this->__setError(2, "No Session vars set");
return false;
}
/**
* Tells Session to write a notification when a certain session path or subpath is written to
*
* @param mixed $var The variable path to watch
* @return void
* @access public
*/
function watch($var) {
$var = $this->__validateKeys($var);
if (empty($var)) {
return false;
}
$this->watchKeys[] = $var;
}
/**
* Tells Session to stop watching a given key path
*
* @param mixed $var The variable path to watch
* @return void
* @access public
*/
function ignore($var) {
$var = $this->__validateKeys($var);
if (!in_array($var, $this->watchKeys)) {
return;
}
foreach ($this->watchKeys as $i => $key) {
if ($key == $var) {
unset($this->watchKeys[$i]);
$this->watchKeys = array_values($this->watchKeys);
return;
}
}
}
/**
* Writes value to given session variable name.
*
* @param mixed $name Name of variable
* @param string $value Value to write
* @return boolean True if the write was successful, false if the write failed
* @access public
*/
function write($name, $value) {
$var = $this->__validateKeys($name);
if (empty($var)) {
return false;
}
if (in_array($var, $this->watchKeys)) {
trigger_error('Writing session key {' . $var . '}: ' . Debugger::exportVar($value), E_USER_NOTICE);
}
$this->__overwrite($_SESSION, Set::insert($_SESSION, $var, $value));
return (Set::extract($_SESSION, $var) === $value);
}
/**
* Helper method to destroy invalid sessions.
*
* @return void
* @access public
*/
function destroy() {
$_SESSION = array();
$this->__construct($this->path);
$this->start();
$this->renew();
$this->_checkValid();
}
/**
* Helper method to initialize a session, based on Cake core settings.
*
* @access private
*/
function __initSession() {
$iniSet = function_exists('ini_set');
if ($iniSet && env('HTTPS')) {
ini_set('session.cookie_secure', 1);
}
switch ($this->security) {
case 'high':
$this->cookieLifeTime = 0;
if ($iniSet) {
ini_set('session.referer_check', $this->host);
}
break;
case 'medium':
$this->cookieLifeTime = 7 * 86400;
if ($iniSet) {
ini_set('session.referer_check', $this->host);
}
break;
case 'low':
default:
$this->cookieLifeTime = 788940000;
break;
}
switch (Configure::read('Session.save')) {
case 'cake':
if (empty($_SESSION)) {
if ($iniSet) {
ini_set('session.use_trans_sid', 0);
ini_set('url_rewriter.tags', '');
ini_set('session.serialize_handler', 'php');
ini_set('session.use_cookies', 1);
ini_set('session.name', Configure::read('Session.cookie'));
ini_set('session.cookie_lifetime', $this->cookieLifeTime);
ini_set('session.cookie_path', $this->path);
ini_set('session.auto_start', 0);
ini_set('session.save_path', TMP . 'sessions');
}
}
break;
case 'database':
if (empty($_SESSION)) {
if (Configure::read('Session.table') === null) {
trigger_error(__("You must set the all Configure::write('Session.*') in core.php to use database storage"), E_USER_WARNING);
exit();
} elseif (Configure::read('Session.database') === null) {
Configure::write('Session.database', 'default');
}
if ($iniSet) {
ini_set('session.use_trans_sid', 0);
ini_set('url_rewriter.tags', '');
ini_set('session.save_handler', 'user');
ini_set('session.serialize_handler', 'php');
ini_set('session.use_cookies', 1);
ini_set('session.name', Configure::read('Session.cookie'));
ini_set('session.cookie_lifetime', $this->cookieLifeTime);
ini_set('session.cookie_path', $this->path);
ini_set('session.auto_start', 0);
}
}
session_set_save_handler(array('CakeSession','__open'),
array('CakeSession', '__close'),
array('CakeSession', '__read'),
array('CakeSession', '__write'),
array('CakeSession', '__destroy'),
array('CakeSession', '__gc'));
break;
case 'php':
if (empty($_SESSION)) {
if ($iniSet) {
ini_set('session.use_trans_sid', 0);
ini_set('session.name', Configure::read('Session.cookie'));
ini_set('session.cookie_lifetime', $this->cookieLifeTime);
ini_set('session.cookie_path', $this->path);
}
}
break;
case 'cache':
if (empty($_SESSION)) {
if (!class_exists('Cache')) {
uses('Cache');
}
if ($iniSet) {
ini_set('session.use_trans_sid', 0);
ini_set('url_rewriter.tags', '');
ini_set('session.save_handler', 'user');
ini_set('session.use_cookies', 1);
ini_set('session.name', Configure::read('Session.cookie'));
ini_set('session.cookie_lifetime', $this->cookieLifeTime);
ini_set('session.cookie_path', $this->path);
}
}
session_set_save_handler(array('CakeSession','__open'),
array('CakeSession', '__close'),
array('Cache', 'read'),
array('Cache', 'write'),
array('Cache', 'delete'),
array('CakeSession', '__gc'));
break;
default:
if (empty($_SESSION)) {
$config = CONFIGS . Configure::read('Session.save') . '.php';
if (is_file($config)) {
require_once ($config);
}
}
break;
}
}
/**
* Helper method to start a session
*
* @access private
*/
function __startSession() {
if (headers_sent()) {
if (empty($_SESSION)) {
$_SESSION = array();
}
return false;
} elseif (!isset($_SESSION)) {
session_cache_limiter ("must-revalidate");
session_start();
header ('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
return true;
} else {
session_start();
return true;
}
}
/**
* Helper method to create a new session.
*
* @return void
* @access protected
*/
function _checkValid() {
if ($this->read('Config')) {
if ((Configure::read('Session.checkAgent') === false || $this->_userAgent == $this->read('Config.userAgent')) && $this->time <= $this->read('Config.time')) {
$time = $this->read('Config.time');
$this->write('Config.time', $this->sessionTime);
if (Configure::read('Security.level') === 'high') {
$check = $this->read('Config.timeout');
$check = $check - 1;
$this->write('Config.timeout', $check);
if (time() > ($time - (Security::inactiveMins() * Configure::read('Session.timeout')) + 2) || $check < 1) {
$this->renew();
$this->write('Config.timeout', 10);
}
}
$this->valid = true;
} else {
$this->destroy();
$this->valid = false;
$this->__setError(1, 'Session Highjacking Attempted !!!');
}
} else {
srand ((double)microtime() * 1000000);
$this->write('Config.userAgent', $this->_userAgent);
$this->write('Config.time', $this->sessionTime);
$this->write('Config.rand', mt_rand());
$this->write('Config.timeout', 10);
$this->valid = true;
$this->__setError(1, 'Session is valid');
}
}
/**
* Helper method to restart a session.
*
* @return void
* @access private
*/
function __regenerateId() {
$oldSessionId = session_id();
if ($oldSessionId) {
$sessionpath = session_save_path();
if (empty($sessionpath)) {
$sessionpath = "/tmp";
}
if (session_id() != "" || isset($_COOKIE[session_name()])) {
setcookie(Configure::read('Session.cookie'), '', time() - 42000, $this->path);
}
session_regenerate_id(true);
if (PHP_VERSION < 5.1) {
$newSessid = session_id();
if (function_exists('session_write_close')) {
session_write_close();
}
$this->__initSession();
session_id($oldSessionId);
session_start();
session_destroy();
$file = $sessionpath . DS . "sess_$oldSessionId";
@unlink($file);
$this->__initSession();
session_id($newSessid);
session_start();
}
}
}
/**
* Restarts this session.
*
* @access public
*/
function renew() {
$this->__regenerateId();
}
/**
* Validate that the $name is in correct dot notation
* example: $name = 'ControllerName.key';
*
* @param string $name Session key names as string.
* @return mixed false is $name is not correct format, or $name if it is correct
* @access private
*/
function __validateKeys($name) {
if (is_string($name) && preg_match("/^[ 0-9a-zA-Z._-]*$/", $name)) {
return $name;
}
$this->__setError(3, "$name is not a string");
return false;
}
/**
* Helper method to set an internal error message.
*
* @param integer $errorNumber Number of the error
* @param string $errorMessage Description of the error
* @return void
* @access private
*/
function __setError($errorNumber, $errorMessage) {
if ($this->error === false) {
$this->error = array();
}
$this->error[$errorNumber] = $errorMessage;
$this->lastError = $errorNumber;
}
/**
* Method called on open of a database session.
*
* @return boolean Success
* @access private
*/
function __open() {
return true;
}
/**
* Method called on close of a database session.
*
* @return boolean Success
* @access private
*/
function __close() {
$probability = mt_rand(1, 150);
if ($probability <= 3) {
switch (Configure::read('Session.save')) {
case 'cache':
Cache::gc();
break;
default:
CakeSession::__gc();
break;
}
}
return true;
}
/**
* Method used to read from a database session.
*
* @param mixed $key The key of the value to read
* @return mixed The value of the key or false if it does not exist
* @access private
*/
function __read($key) {
$db =& ConnectionManager::getDataSource(Configure::read('Session.database'));
$table = $db->fullTableName(Configure::read('Session.table'), false);
$row = $db->query("SELECT " . $db->name($table.'.data') . " FROM " . $db->name($table) . " WHERE " . $db->name($table.'.id') . " = " . $db->value($key), false);
if ($row && !isset($row[0][$table]) && isset($row[0][0])) {
$table = 0;
}
if ($row && $row[0][$table]['data']) {
return $row[0][$table]['data'];
} else {
return false;
}
}
/**
* Helper function called on write for database sessions.
*
* @param mixed $key The name of the var
* @param mixed $value The value of the var
* @return boolean Success
* @access private
*/
function __write($key, $value) {
$db =& ConnectionManager::getDataSource(Configure::read('Session.database'));
$table = $db->fullTableName(Configure::read('Session.table'));
switch (Configure::read('Security.level')) {
case 'high':
$factor = 10;
break;
case 'medium':
$factor = 100;
break;
case 'low':
$factor = 300;
break;
default:
$factor = 10;
break;
}
$expires = time() + Configure::read('Session.timeout') * $factor;
$row = $db->query("SELECT COUNT(id) AS count FROM " . $db->name($table) . " WHERE "
. $db->name('id') . " = "
. $db->value($key), false);
if ($row[0][0]['count'] > 0) {
$db->execute("UPDATE " . $db->name($table) . " SET " . $db->name('data') . " = "
. $db->value($value) . ", " . $db->name('expires') . " = "
. $db->value($expires) . " WHERE " . $db->name('id') . " = "
. $db->value($key));
} else {
$db->execute("INSERT INTO " . $db->name($table) . " (" . $db->name('data') . ","
. $db->name('expires') . "," . $db->name('id')
. ") VALUES (" . $db->value($value) . ", " . $db->value($expires) . ", "
. $db->value($key) . ")");
}
return true;
}
/**
* Method called on the destruction of a database session.
*
* @param integer $key Key that uniquely identifies session in database
* @return boolean Success
* @access private
*/
function __destroy($key) {
$db =& ConnectionManager::getDataSource(Configure::read('Session.database'));
$table = $db->fullTableName(Configure::read('Session.table'));
$db->execute("DELETE FROM " . $db->name($table) . " WHERE " . $db->name($table.'.id') . " = " . $db->value($key));
return true;
}
/**
* Helper function called on gc for database sessions.
*
* @param integer $expires Timestamp (defaults to current time)
* @return boolean Success
* @access private
*/
function __gc($expires = null) {
$db =& ConnectionManager::getDataSource(Configure::read('Session.database'));
$table = $db->fullTableName(Configure::read('Session.table'));
$db->execute("DELETE FROM " . $db->name($table) . " WHERE " . $db->name($table.'.expires') . " < ". $db->value(time()));
return true;
}
}
?>

View file

@ -663,7 +663,7 @@ class EmailComponent extends Object{
* @access private
*/
function __smtp() {
App::import('Core', array('Socket'));
App::import('Core', array('CakeSocket'));
$this->__smtpConnection =& new CakeSocket(array_merge(array('protocol'=>'smtp'), $this->smtpOptions));

View file

@ -22,7 +22,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', array('Socket', 'Set', 'Router'));
App::import('Core', array('CakeSocket', 'Set', 'Router'));
/**
* Cake network socket connection class.
*
@ -40,7 +40,8 @@ class HttpSocket extends CakeSocket {
*/
var $description = 'HTTP-based DataSource Interface';
/**
* When one activates the $quirksMode by setting it to true, all checks meant to enforce RFC 2616 (HTTP/1.1 specs)
* When one activates the $quirksMode by setting it to true, all checks meant to
* enforce RFC 2616 (HTTP/1.1 specs).
* will be disabled and additional measures to deal with non-standard responses will be enabled.
*
* @var boolean
@ -143,10 +144,10 @@ class HttpSocket extends CakeSocket {
*/
function __construct($config = array()) {
if (is_string($config)) {
$this->configUri($config);
$this->_configUri($config);
} elseif (is_array($config)) {
if (isset($config['request']['uri']) && is_string($config['request']['uri'])) {
$this->configUri($config['request']['uri']);
$this->_configUri($config['request']['uri']);
unset($config['request']['uri']);
}
$this->config = Set::merge($this->config, $config);
@ -172,7 +173,7 @@ class HttpSocket extends CakeSocket {
if (!isset($request['uri'])) {
$request['uri'] = null;
}
$uri = $this->parseUri($request['uri']);
$uri = $this->_parseUri($request['uri']);
if (!isset($uri['host'])) {
$host = $this->config['host'];
@ -183,10 +184,10 @@ class HttpSocket extends CakeSocket {
}
$request['uri'] = $this->url($request['uri']);
$request['uri'] = $this->parseUri($request['uri'], true);
$request['uri'] = $this->_parseUri($request['uri'], true);
$this->request = Set::merge($this->request, $this->config['request'], $request);
$this->configUri($this->request['uri']);
$this->_configUri($this->request['uri']);
if (isset($host)) {
$this->config['host'] = $host;
@ -194,7 +195,7 @@ class HttpSocket extends CakeSocket {
$cookies = null;
if (is_array($this->request['header'])) {
$this->request['header'] = $this->parseHeader($this->request['header']);
$this->request['header'] = $this->_parseHeader($this->request['header']);
if (!empty($this->request['cookies'])) {
$cookies = $this->buildCookies($this->request['cookies']);
}
@ -209,7 +210,7 @@ class HttpSocket extends CakeSocket {
}
if (is_array($this->request['body'])) {
$this->request['body'] = $this->httpSerialize($this->request['body']);
$this->request['body'] = $this->_httpSerialize($this->request['body']);
}
if (!empty($this->request['body']) && !isset($this->request['header']['Content-Type'])) {
@ -221,10 +222,10 @@ class HttpSocket extends CakeSocket {
}
$connectionType = @$this->request['header']['Connection'];
$this->request['header'] = $this->buildHeader($this->request['header']).$cookies;
$this->request['header'] = $this->_buildHeader($this->request['header']).$cookies;
if (empty($this->request['line'])) {
$this->request['line'] = $this->buildRequestLine($this->request);
$this->request['line'] = $this->_buildRequestLine($this->request);
}
if ($this->quirksMode === false && $this->request['line'] === false) {
@ -252,7 +253,7 @@ class HttpSocket extends CakeSocket {
$this->disconnect();
}
$this->response = $this->parseResponse($response);
$this->response = $this->_parseResponse($response);
if (!empty($this->response['cookies'])) {
$this->config['request']['cookies'] = array_merge($this->config['request']['cookies'], $this->response['cookies']);
}
@ -262,7 +263,7 @@ class HttpSocket extends CakeSocket {
/**
* Issues a GET request to the specified URI, query, and request.
*
* @param mixed $uri URI to request (see {@link parseUri()})
* @param mixed $uri URI to request (see {@link _parseUri()})
* @param array $query Query to append to URI
* @param array $request An indexed array with indexes such as 'method' or uri
* @return mixed Result of request
@ -270,13 +271,13 @@ class HttpSocket extends CakeSocket {
*/
function get($uri = null, $query = array(), $request = array()) {
if (!empty($query)) {
$uri =$this->parseUri($uri);
$uri =$this->_parseUri($uri);
if (isset($uri['query'])) {
$uri['query'] = array_merge($uri['query'], $query);
} else {
$uri['query'] = $query;
}
$uri = $this->buildUri($uri);
$uri = $this->_buildUri($uri);
}
$request = Set::merge(array('method' => 'GET', 'uri' => $uri), $request);
@ -286,7 +287,7 @@ class HttpSocket extends CakeSocket {
/**
* Issues a POST request to the specified URI, query, and request.
*
* @param mixed $uri URI to request (see {@link parseUri()})
* @param mixed $uri URI to request (see {@link _parseUri()})
* @param array $query Query to append to URI
* @param array $request An indexed array with indexes such as 'method' or uri
* @return mixed Result of request
@ -299,7 +300,7 @@ class HttpSocket extends CakeSocket {
/**
* Issues a PUT request to the specified URI, query, and request.
*
* @param mixed $uri URI to request (see {@link parseUri()})
* @param mixed $uri URI to request (see {@link _parseUri()})
* @param array $query Query to append to URI
* @param array $request An indexed array with indexes such as 'method' or uri
* @return mixed Result of request
@ -312,7 +313,7 @@ class HttpSocket extends CakeSocket {
/**
* Issues a DELETE request to the specified URI, query, and request.
*
* @param mixed $uri URI to request (see {@link parseUri()})
* @param mixed $uri URI to request (see {@link _parseUri()})
* @param array $query Query to append to URI
* @param array $request An indexed array with indexes such as 'method' or uri
* @return mixed Result of request
@ -346,16 +347,16 @@ class HttpSocket extends CakeSocket {
}
$base = array_merge($this->config['request']['uri'], array('scheme' => array('http', 'https'), 'port' => array(80, 443)));
$url = $this->parseUri($url, $base);
$url = $this->_parseUri($url, $base);
if (empty($url)) {
$url = $this->config['request']['uri'];
}
if (!empty($uriTemplate)) {
return $this->buildUri($url, $uriTemplate);
return $this->_buildUri($url, $uriTemplate);
}
return $this->buildUri($url);
return $this->_buildUri($url);
}
/**
* Parses the given message and breaks it down in parts.
@ -364,7 +365,7 @@ class HttpSocket extends CakeSocket {
* @return array Parsed message (with indexed elements such as raw, status, header, body)
* @access protected
*/
function parseResponse($message) {
function _parseResponse($message) {
if (is_array($message)) {
return $message;
} elseif (!is_string($message)) {
@ -394,12 +395,12 @@ class HttpSocket extends CakeSocket {
$response['status']['reason-phrase'] = $match[3];
}
$response['header'] = $this->parseHeader($response['raw']['header']);
$decoded = $this->decodeBody($response['raw']['body'], @$response['header']['Transfer-Encoding']);
$response['header'] = $this->_parseHeader($response['raw']['header']);
$decoded = $this->_decodeBody($response['raw']['body'], @$response['header']['Transfer-Encoding']);
$response['body'] = $decoded['body'];
if (!empty($decoded['header'])) {
$response['header'] = $this->parseHeader($this->buildHeader($response['header']).$this->buildHeader($decoded['header']));
$response['header'] = $this->_parseHeader($this->_buildHeader($response['header']).$this->_buildHeader($decoded['header']));
}
if (!empty($response['header'])) {
@ -423,7 +424,7 @@ class HttpSocket extends CakeSocket {
* @return mixed Array or false
* @access protected
*/
function decodeBody($body, $encoding = 'chunked') {
function _decodeBody($body, $encoding = 'chunked') {
if (!is_string($body)) {
return false;
}
@ -434,7 +435,7 @@ class HttpSocket extends CakeSocket {
if (!is_callable(array(&$this, $decodeMethod))) {
if (!$this->quirksMode) {
trigger_error(sprintf(__('HttpSocket::decodeBody - Unknown encoding: %s. Activate quirks mode to surpress error.', true), h($encoding)), E_USER_WARNING);
trigger_error(sprintf(__('HttpSocket::_decodeBody - Unknown encoding: %s. Activate quirks mode to surpress error.', true), h($encoding)), E_USER_WARNING);
}
return array('body' => $body, 'header' => false);
}
@ -448,7 +449,7 @@ class HttpSocket extends CakeSocket {
* @return mixed Array or false
* @access protected
*/
function decodeChunkedBody($body) {
function _decodeChunkedBody($body) {
if (!is_string($body)) {
return false;
}
@ -459,7 +460,7 @@ class HttpSocket extends CakeSocket {
while ($chunkLength !== 0) {
if (!preg_match("/^([0-9a-f]+) *(?:;(.+)=(.+))?\r\n/iU", $body, $match)) {
if (!$this->quirksMode) {
trigger_error(__('HttpSocket::decodeChunkedBody - Could not parse malformed chunk. Activate quirks mode to do this.', true), E_USER_WARNING);
trigger_error(__('HttpSocket::_decodeChunkedBody - Could not parse malformed chunk. Activate quirks mode to do this.', true), E_USER_WARNING);
return false;
}
break;
@ -498,26 +499,26 @@ class HttpSocket extends CakeSocket {
$entityHeader = false;
if (!empty($body)) {
$entityHeader = $this->parseHeader($body);
$entityHeader = $this->_parseHeader($body);
}
return array('body' => $decodedBody, 'header' => $entityHeader);
}
/**
* Parses and sets the specified URI into current request configuration.
*
* @param mixed $uri URI (see {@link parseUri()})
* @param mixed $uri URI (see {@link _parseUri()})
* @return array Current configuration settings
* @access protected
*/
function configUri($uri = null) {
function _configUri($uri = null) {
if (empty($uri)) {
return false;
}
if (is_array($uri)) {
$uri = $this->parseUri($uri);
$uri = $this->_parseUri($uri);
} else {
$uri = $this->parseUri($uri, true);
$uri = $this->_parseUri($uri, true);
}
if (!isset($uri['host'])) {
@ -542,18 +543,18 @@ class HttpSocket extends CakeSocket {
* @return string A fully qualified URL formated according to $uriTemplate
* @access protected
*/
function buildUri($uri = array(), $uriTemplate = '%scheme://%user:%pass@%host:%port/%path?%query#%fragment') {
function _buildUri($uri = array(), $uriTemplate = '%scheme://%user:%pass@%host:%port/%path?%query#%fragment') {
if (is_string($uri)) {
$uri = array('host' => $uri);
}
$uri = $this->parseUri($uri, true);
$uri = $this->_parseUri($uri, true);
if (!is_array($uri) || empty($uri)) {
return false;
}
$uri['path'] = preg_replace('/^\//', null, $uri['path']);
$uri['query'] = $this->httpSerialize($uri['query']);
$uri['query'] = $this->_httpSerialize($uri['query']);
$stripIfEmpty = array(
'query' => '?%query',
'fragment' => '#%fragment',
@ -589,7 +590,7 @@ class HttpSocket extends CakeSocket {
* @return array Parsed URI
* @access protected
*/
function parseUri($uri = null, $base = array()) {
function _parseUri($uri = null, $base = array()) {
$uriBase = array(
'scheme' => array('http', 'https'),
'host' => null,
@ -631,7 +632,7 @@ class HttpSocket extends CakeSocket {
}
if (array_key_exists('query', $uri)) {
$uri['query'] = $this->parseQuery($uri['query']);
$uri['query'] = $this->_parseQuery($uri['query']);
}
if (!array_intersect_key($uriBase, $uri)) {
@ -647,13 +648,13 @@ class HttpSocket extends CakeSocket {
* - ?key[]=value1&key[]=value2
*
* A leading '?' mark in $query is optional and does not effect the outcome of this function. For the complete capabilities of this implementation
* take a look at HttpSocketTest::testParseQuery()
* take a look at HttpSocketTest::testparseQuery()
*
* @param mixed $query A query string to parse into an array or an array to return directly "as is"
* @return array The $query parsed into a possibly multi-level array. If an empty $query is given, an empty array is returned.
* @access protected
*/
function parseQuery($query) {
function _parseQuery($query) {
if (is_array($query)) {
return $query;
}
@ -710,13 +711,13 @@ class HttpSocket extends CakeSocket {
* @return string Request line
* @access protected
*/
function buildRequestLine($request = array(), $versionToken = 'HTTP/1.1') {
function _buildRequestLine($request = array(), $versionToken = 'HTTP/1.1') {
$asteriskMethods = array('OPTIONS');
if (is_string($request)) {
$isValid = preg_match("/(.+) (.+) (.+)\r\n/U", $request, $match);
if (!$this->quirksMode && (!$isValid || ($match[2] == '*' && !in_array($match[3], $asteriskMethods)))) {
trigger_error(__('HttpSocket::buildRequestLine - Passed an invalid request line string. Activate quirks mode to do this.', true), E_USER_WARNING);
trigger_error(__('HttpSocket::_buildRequestLine - Passed an invalid request line string. Activate quirks mode to do this.', true), E_USER_WARNING);
return false;
}
return $request;
@ -726,12 +727,12 @@ class HttpSocket extends CakeSocket {
return false;
}
$request['uri'] = $this->parseUri($request['uri']);
$request['uri'] = $this->_parseUri($request['uri']);
$request = array_merge(array('method' => 'GET'), $request);
$request['uri'] = $this->buildUri($request['uri'], '/%path?%query');
$request['uri'] = $this->_buildUri($request['uri'], '/%path?%query');
if (!$this->quirksMode && $request['uri'] === '*' && !in_array($request['method'], $asteriskMethods)) {
trigger_error(sprintf(__('HttpSocket::buildRequestLine - The "*" asterisk character is only allowed for the following methods: %s. Activate quirks mode to work outside of HTTP/1.1 specs.', true), join(',', $asteriskMethods)), E_USER_WARNING);
trigger_error(sprintf(__('HttpSocket::_buildRequestLine - The "*" asterisk character is only allowed for the following methods: %s. Activate quirks mode to work outside of HTTP/1.1 specs.', true), join(',', $asteriskMethods)), E_USER_WARNING);
return false;
}
return $request['method'].' '.$request['uri'].' '.$versionToken.$this->lineBreak;
@ -743,7 +744,7 @@ class HttpSocket extends CakeSocket {
* @return string Serialized variable
* @access protected
*/
function httpSerialize($data = array()) {
function _httpSerialize($data = array()) {
if (is_string($data)) {
return $data;
}
@ -759,7 +760,7 @@ class HttpSocket extends CakeSocket {
* @return string Header built from array
* @access protected
*/
function buildHeader($header, $mode = 'standard') {
function _buildHeader($header, $mode = 'standard') {
if (is_string($header)) {
return $header;
} elseif (!is_array($header)) {
@ -773,7 +774,7 @@ class HttpSocket extends CakeSocket {
}
foreach ((array)$contents as $content) {
$contents = preg_replace("/\r\n(?![\t ])/", "\r\n ", $content);
$field = $this->escapeToken($field);
$field = $this->_escapeToken($field);
$returnHeader .= $field.': '.$contents.$this->lineBreak;
}
@ -788,7 +789,7 @@ class HttpSocket extends CakeSocket {
* @return array Parsed header
* @access protected
*/
function parseHeader($header) {
function _parseHeader($header) {
if (is_array($header)) {
foreach ($header as $field => $value) {
unset($header[$field]);
@ -814,7 +815,7 @@ class HttpSocket extends CakeSocket {
$value = trim($value);
$value = preg_replace("/[\t ]\r\n/", "\r\n", $value);
$field = $this->unescapeToken($field);
$field = $this->_unescapeToken($field);
$field = strtolower($field);
preg_match_all('/(?:^|(?<=-))[a-z]/U', $field, $offsets, PREG_OFFSET_CAPTURE);
@ -875,29 +876,11 @@ class HttpSocket extends CakeSocket {
function buildCookies($cookies) {
$header = array();
foreach ($cookies as $name => $cookie) {
$header[] = $name.'='.$this->escapeToken($cookie['value'], array(';'));
$header[] = $name.'='.$this->_escapeToken($cookie['value'], array(';'));
}
$header = $this->buildHeader(array('Cookie' => $header), 'pragmatic');
$header = $this->_buildHeader(array('Cookie' => $header), 'pragmatic');
return $header;
}
/**
* undocumented function
*
* @return void
* @access public
*/
function saveCookies() {
}
/**
* undocumented function
*
* @return void
* @access public
*/
function loadCookies() {
}
/**
* Unescapes a given $token according to RFC 2616 (HTTP 1.1 specs)
*
@ -906,8 +889,8 @@ class HttpSocket extends CakeSocket {
* @access protected
* @todo Test $chars parameter
*/
function unescapeToken($token, $chars = null) {
$regex = '/"(['.join('', $this->__tokenEscapeChars(true, $chars)).'])"/';
function _unescapeToken($token, $chars = null) {
$regex = '/"(['.join('', $this->_tokenEscapeChars(true, $chars)).'])"/';
$token = preg_replace($regex, '\\1', $token);
return $token;
}
@ -919,8 +902,8 @@ class HttpSocket extends CakeSocket {
* @access protected
* @todo Test $chars parameter
*/
function escapeToken($token, $chars = null) {
$regex = '/(['.join('', $this->__tokenEscapeChars(true, $chars)).'])/';
function _escapeToken($token, $chars = null) {
$regex = '/(['.join('', $this->_tokenEscapeChars(true, $chars)).'])/';
$token = preg_replace($regex, '"\\1"', $token);
return $token;
}
@ -929,10 +912,10 @@ class HttpSocket extends CakeSocket {
*
* @param boolean $hex true to get them as HEX values, false otherwise
* @return array Escape chars
* @access private
* @access protected
* @todo Test $chars parameter
*/
function __tokenEscapeChars($hex = true, $chars = null) {
function _tokenEscapeChars($hex = true, $chars = null) {
if (!empty($chars)) {
$escape = $chars;
} else {

View file

@ -23,7 +23,7 @@
* Included libs
*/
App::import('Core', array(
'ClassRegistry', 'Overloadable', 'Validation', 'Behavior', 'ConnectionManager', 'Set', 'String'
'ClassRegistry', 'Overloadable', 'Validation', 'ModelBehavior', 'ConnectionManager', 'Set', 'String'
));
/**
* Object-relational mapper.

View file

@ -25,7 +25,7 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
if (!class_exists('CakeSession')) {
App::import('Core', 'Session');
App::import('Core', 'CakeSession');
}
/**
* SessionTest class

View file

@ -24,14 +24,14 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', 'Socket');
App::import('Core', 'CakeSocket');
/**
* SocketTest class
*
* @package cake
* @subpackage cake.tests.cases.libs
*/
class SocketTest extends CakeTestCase {
class CakeSocketTest extends CakeTestCase {
/**
* setUp method
*

View file

@ -440,11 +440,11 @@ class AppImportTest extends UnitTestCase {
* @return void
*/
function testMultipleLoading() {
$toLoad = array('I18n', 'Socket');
$toLoad = array('I18n', 'CakeSocket');
$classes = array_flip(get_declared_classes());
$this->assertFalse(isset($classes['i18n']));
$this->assertFalse(isset($classes['Socket']));
$this->assertFalse(isset($classes['CakeSocket']));
$load = App::import($toLoad);
$this->assertTrue($load);
@ -457,7 +457,7 @@ class AppImportTest extends UnitTestCase {
$this->assertTrue(isset($classes['i18n']));
}
$load = App::import(array('I18n', 'SomeNotFoundClass', 'Socket'));
$load = App::import(array('I18n', 'SomeNotFoundClass', 'CakeSocket'));
$this->assertFalse($load);
$load = App::import($toLoad);

View file

@ -25,6 +25,132 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', 'HttpSocket');
class TestHttpSocket extends HttpSocket {
/**
* Convenience method for testing protected method
*
* @param mixed $uri URI (see {@link _parseUri()})
* @return array Current configuration settings
*/
function configUri($uri = null) {
return parent::_configUri($uri);
}
/**
* Convenience method for testing protected method
*
* @param string $uri URI to parse
* @param mixed $base If true use default URI config, otherwise indexed array to set 'scheme', 'host', 'port', etc.
* @return array Parsed URI
*/
function parseUri($uri = null, $base = array()) {
return parent::_parseUri($uri, $base);
}
/**
* Convenience method for testing protected method
*
* @param array $uri A $uri array, or uses $this->config if left empty
* @param string $uriTemplate The Uri template/format to use
* @return string A fully qualified URL formated according to $uriTemplate
*/
function buildUri($uri = array(), $uriTemplate = '%scheme://%user:%pass@%host:%port/%path?%query#%fragment') {
return parent::_buildUri($uri, $uriTemplate);
}
/**
* Convenience method for testing protected method
*
* @param array $header Header to build
* @return string Header built from array
*/
function buildHeader($header, $mode = 'standard') {
return parent::_buildHeader($header, $mode);
}
/**
* Convenience method for testing protected method
*
* @param string $message Message to parse
* @return array Parsed message (with indexed elements such as raw, status, header, body)
*/
function parseResponse($message) {
return parent::_parseResponse($message);
}
/**
* Convenience method for testing protected method
*
* @param array $header Header as an indexed array (field => value)
* @return array Parsed header
*/
function parseHeader($header) {
return parent::_parseHeader($header);
}
/**
* Convenience method for testing protected method
*
* @param mixed $query A query string to parse into an array or an array to return directly "as is"
* @return array The $query parsed into a possibly multi-level array. If an empty $query is given, an empty array is returned.
*/
function parseQuery($query) {
return parent::_parseQuery($query);
}
/**
* Convenience method for testing protected method
*
* @param string $body A string continaing the body to decode
* @param mixed $encoding Can be false in case no encoding is being used, or a string representing the encoding
* @return mixed Array or false
*/
function decodeBody($body, $encoding = 'chunked') {
return parent::_decodeBody($body, $encoding);
}
/**
* Convenience method for testing protected method
*
* @param string $body A string continaing the chunked body to decode
* @return mixed Array or false
*/
function decodeChunkedBody($body) {
return parent::_decodeChunkedBody($body);
}
/**
* Convenience method for testing protected method
*
* @param array $request Needs to contain a 'uri' key. Should also contain a 'method' key, otherwise defaults to GET.
* @param string $versionToken The version token to use, defaults to HTTP/1.1
* @return string Request line
*/
function buildRequestLine($request = array(), $versionToken = 'HTTP/1.1') {
return parent::_buildRequestLine($request, $versionToken);
}
/**
* Convenience method for testing protected method
*
* @param boolean $hex true to get them as HEX values, false otherwise
* @return array Escape chars
*/
function tokenEscapeChars($hex = true, $chars = null) {
return parent::_tokenEscapeChars($hex, $chars);
}
/**
* Convenience method for testing protected method
*
* @param string $token Token to escape
* @return string Escaped token
*/
function EscapeToken($token, $chars = null) {
return parent::_escapeToken($token, $chars);
}
/**
* Convenience method for testing protected method
*
* @param string $token Token to unescape
* @return string Unescaped token
*/
function unescapeToken($token, $chars = null) {
return parent::_unescapeToken($token, $chars);
}
}
/**
* HttpSocketTest class
*
@ -53,13 +179,13 @@ class HttpSocketTest extends CakeTestCase {
* @return void
*/
function setUp() {
if (!class_exists('TestHttpSocket')) {
Mock::generatePartial('HttpSocket', 'TestHttpSocket', array('read', 'write', 'connect'));
Mock::generatePartial('HttpSocket', 'TestHttpSocketRequests', array('read', 'write', 'connect', 'request'));
if (!class_exists('MockHttpSocket')) {
Mock::generatePartial('TestHttpSocket', 'MockHttpSocket', array('read', 'write', 'connect'));
Mock::generatePartial('TestHttpSocket', 'MockHttpSocketRequests', array('read', 'write', 'connect', 'request'));
}
$this->Socket =& new TestHttpSocket();
$this->RequestSocket =& new TestHttpSocketRequests();
$this->Socket =& new MockHttpSocket();
$this->RequestSocket =& new MockHttpSocketRequests();
}
/**
* We use this function to clean up after the test case was executed
@ -373,12 +499,6 @@ class HttpSocketTest extends CakeTestCase {
$r = array('config' => $this->Socket->config, 'request' => $this->Socket->request);
$v = $this->assertIdentical($r, $expectation, '%s in test #'.$i.' ');
if (!$v) {
debug('Result:');
debug($r);
debug('Expected:');
debug($expectation);
}
$expectation['request']['raw'] = $raw;
}
@ -1209,7 +1329,7 @@ class HttpSocketTest extends CakeTestCase {
$this->assertEqual($result, $expect);
}
/**
* Tests that HttpSocket::__tokenEscapeChars() returns the right characters.
* Tests that HttpSocket::_tokenEscapeChars() returns the right characters.
*
* @access public
* @return void
@ -1223,14 +1343,14 @@ class HttpSocketTest extends CakeTestCase {
'\x0e','\x0f','\x10','\x11','\x12','\x13','\x14','\x15','\x16','\x17','\x18','\x19','\x1a','\x1b','\x1c','\x1d',
'\x1e','\x1f','\x7f'
);
$r = $this->Socket->__tokenEscapeChars();
$r = $this->Socket->tokenEscapeChars();
$this->assertEqual($r, $expected);
foreach ($expected as $key => $char) {
$expected[$key] = chr(hexdec(substr($char, 2)));
}
$r = $this->Socket->__tokenEscapeChars(false);
$r = $this->Socket->tokenEscapeChars(false);
$this->assertEqual($r, $expected);
}
/**
@ -1244,7 +1364,7 @@ class HttpSocketTest extends CakeTestCase {
$this->assertIdentical($this->Socket->escapeToken('Foo'), 'Foo');
$escape = $this->Socket->__tokenEscapeChars(false);
$escape = $this->Socket->tokenEscapeChars(false);
foreach ($escape as $char) {
$token = 'My-special-'.$char.'-Token';
$escapedToken = $this->Socket->escapeToken($token);
@ -1269,7 +1389,7 @@ class HttpSocketTest extends CakeTestCase {
$this->assertIdentical($this->Socket->unescapeToken('Foo'), 'Foo');
$escape = $this->Socket->__tokenEscapeChars(false);
$escape = $this->Socket->tokenEscapeChars(false);
foreach ($escape as $char) {
$token = 'My-special-"'.$char.'"-Token';
$unescapedToken = $this->Socket->unescapeToken($token);

View file

@ -23,7 +23,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', 'Schema');
App::import('Core', 'CakeSchema');
/**
* Test for Schema database management
*

View file

@ -509,7 +509,7 @@ class DboMysqlTest extends CakeTestCase {
* @return void
*/
function testAlterSchemaIndexes() {
App::import('Core', 'Schema');
App::import('Core', 'CakeSchema');
$this->db->cacheSources = $this->db->testing = false;
$schema1 =& new CakeSchema(array(

View file

@ -52,7 +52,7 @@ class NoDatabaseGroupTest extends GroupTest {
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'inflector');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'validation');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'session');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'socket');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'cake_socket');
TestManager::addTestCasesFromDirectory($this, CORE_TEST_CASES . DS . 'libs' . DS . 'view');
}
}

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* SocketGroupTest file
* Short description for file.
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake
* @package cake.tests
* @subpackage cake.tests.groups
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -24,11 +24,16 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
/**
* SocketGroupTest class
/** Socket and HttpSocket tests
*
* This test group will run socket class tests (socket, http_socket).
*
* @package cake.tests
* @subpackage cake.tests.groups
*/
/**
* SocketGroupTest class
*
* @package cake
* @subpackage cake.tests.groups
*/
@ -39,7 +44,7 @@ class SocketGroupTest extends GroupTest {
* @var string 'Socket and HttpSocket tests'
* @access public
*/
var $label = 'Socket and HttpSocket';
var $label = 'CakeSocket and HttpSocket tests';
/**
* SocketGroupTest method
*
@ -47,7 +52,7 @@ class SocketGroupTest extends GroupTest {
* @return void
*/
function SocketGroupTest() {
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'socket');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'cake_socket');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'http_socket');
}
}

View file

@ -50,7 +50,7 @@ class CakeTestFixture extends Object {
* @access public
*/
function __construct() {
App::import('Model', 'Schema');
App::import('Model', 'CakeSchema');
$this->Schema = new CakeSchema(array('name' => 'TestSuite', 'connection' => 'test_suite'));
$this->init();