Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663

This commit is contained in:
Greg Anderson 2015-10-08 11:40:12 -07:00
parent eb34d130a8
commit f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions

View file

@ -0,0 +1,254 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Tests\Profiler\Mock;
/**
* MemcacheMock for simulating Memcache extension in tests.
*
* @author Andrej Hudec <pulzarraider@gmail.com>
*/
class MemcacheMock
{
private $connected = false;
private $storage = array();
/**
* Open memcached server connection.
*
* @param string $host
* @param int $port
* @param int $timeout
*
* @return bool
*/
public function connect($host, $port = null, $timeout = null)
{
if ('127.0.0.1' == $host && 11211 == $port) {
$this->connected = true;
return true;
}
return false;
}
/**
* Open memcached server persistent connection.
*
* @param string $host
* @param int $port
* @param int $timeout
*
* @return bool
*/
public function pconnect($host, $port = null, $timeout = null)
{
if ('127.0.0.1' == $host && 11211 == $port) {
$this->connected = true;
return true;
}
return false;
}
/**
* Add a memcached server to connection pool.
*
* @param string $host
* @param int $port
* @param bool $persistent
* @param int $weight
* @param int $timeout
* @param int $retry_interval
* @param bool $status
* @param callable $failure_callback
* @param int $timeoutms
*
* @return bool
*/
public function addServer($host, $port = 11211, $persistent = null, $weight = null, $timeout = null, $retry_interval = null, $status = null, $failure_callback = null, $timeoutms = null)
{
if ('127.0.0.1' == $host && 11211 == $port) {
$this->connected = true;
return true;
}
return false;
}
/**
* Add an item to the server only if such key doesn't exist at the server yet.
*
* @param string $key
* @param mixed $var
* @param int $flag
* @param int $expire
*
* @return bool
*/
public function add($key, $var, $flag = null, $expire = null)
{
if (!$this->connected) {
return false;
}
if (!isset($this->storage[$key])) {
$this->storeData($key, $var);
return true;
}
return false;
}
/**
* Store data at the server.
*
* @param string $key
* @param string $var
* @param int $flag
* @param int $expire
*
* @return bool
*/
public function set($key, $var, $flag = null, $expire = null)
{
if (!$this->connected) {
return false;
}
$this->storeData($key, $var);
return true;
}
/**
* Replace value of the existing item.
*
* @param string $key
* @param mixed $var
* @param int $flag
* @param int $expire
*
* @return bool
*/
public function replace($key, $var, $flag = null, $expire = null)
{
if (!$this->connected) {
return false;
}
if (isset($this->storage[$key])) {
$this->storeData($key, $var);
return true;
}
return false;
}
/**
* Retrieve item from the server.
*
* @param string|array $key
* @param int|array $flags
*
* @return mixed
*/
public function get($key, &$flags = null)
{
if (!$this->connected) {
return false;
}
if (is_array($key)) {
$result = array();
foreach ($key as $k) {
if (isset($this->storage[$k])) {
$result[] = $this->getData($k);
}
}
return $result;
}
return $this->getData($key);
}
/**
* Delete item from the server.
*
* @param string $key
*
* @return bool
*/
public function delete($key)
{
if (!$this->connected) {
return false;
}
if (isset($this->storage[$key])) {
unset($this->storage[$key]);
return true;
}
return false;
}
/**
* Flush all existing items at the server.
*
* @return bool
*/
public function flush()
{
if (!$this->connected) {
return false;
}
$this->storage = array();
return true;
}
/**
* Close memcached server connection.
*
* @return bool
*/
public function close()
{
$this->connected = false;
return true;
}
private function getData($key)
{
if (isset($this->storage[$key])) {
return unserialize($this->storage[$key]);
}
return false;
}
private function storeData($key, $value)
{
$this->storage[$key] = serialize($value);
return true;
}
}

View file

@ -0,0 +1,219 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Tests\Profiler\Mock;
/**
* MemcachedMock for simulating Memcached extension in tests.
*
* @author Andrej Hudec <pulzarraider@gmail.com>
*/
class MemcachedMock
{
private $connected = false;
private $storage = array();
/**
* Set a Memcached option.
*
* @param int $option
* @param mixed $value
*
* @return bool
*/
public function setOption($option, $value)
{
return true;
}
/**
* Add a memcached server to connection pool.
*
* @param string $host
* @param int $port
* @param int $weight
*
* @return bool
*/
public function addServer($host, $port = 11211, $weight = 0)
{
if ('127.0.0.1' == $host && 11211 == $port) {
$this->connected = true;
return true;
}
return false;
}
/**
* Add an item to the server only if such key doesn't exist at the server yet.
*
* @param string $key
* @param mixed $value
* @param int $expiration
*
* @return bool
*/
public function add($key, $value, $expiration = 0)
{
if (!$this->connected) {
return false;
}
if (!isset($this->storage[$key])) {
$this->storeData($key, $value);
return true;
}
return false;
}
/**
* Store data at the server.
*
* @param string $key
* @param mixed $value
* @param int $expiration
*
* @return bool
*/
public function set($key, $value, $expiration = null)
{
if (!$this->connected) {
return false;
}
$this->storeData($key, $value);
return true;
}
/**
* Replace value of the existing item.
*
* @param string $key
* @param mixed $value
* @param int $expiration
*
* @return bool
*/
public function replace($key, $value, $expiration = null)
{
if (!$this->connected) {
return false;
}
if (isset($this->storage[$key])) {
$this->storeData($key, $value);
return true;
}
return false;
}
/**
* Retrieve item from the server.
*
* @param string $key
* @param callable $cache_cb
* @param float $cas_token
*
* @return bool
*/
public function get($key, $cache_cb = null, &$cas_token = null)
{
if (!$this->connected) {
return false;
}
return $this->getData($key);
}
/**
* Append data to an existing item.
*
* @param string $key
* @param string $value
*
* @return bool
*/
public function append($key, $value)
{
if (!$this->connected) {
return false;
}
if (isset($this->storage[$key])) {
$this->storeData($key, $this->getData($key).$value);
return true;
}
return false;
}
/**
* Delete item from the server.
*
* @param string $key
*
* @return bool
*/
public function delete($key)
{
if (!$this->connected) {
return false;
}
if (isset($this->storage[$key])) {
unset($this->storage[$key]);
return true;
}
return false;
}
/**
* Flush all existing items at the server.
*
* @return bool
*/
public function flush()
{
if (!$this->connected) {
return false;
}
$this->storage = array();
return true;
}
private function getData($key)
{
if (isset($this->storage[$key])) {
return unserialize($this->storage[$key]);
}
return false;
}
private function storeData($key, $value)
{
$this->storage[$key] = serialize($value);
return true;
}
}

View file

@ -0,0 +1,247 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Tests\Profiler\Mock;
/**
* RedisMock for simulating Redis extension in tests.
*
* @author Andrej Hudec <pulzarraider@gmail.com>
*/
class RedisMock
{
private $connected = false;
private $storage = array();
/**
* Add a server to connection pool.
*
* @param string $host
* @param int $port
* @param float $timeout
*
* @return bool
*/
public function connect($host, $port = 6379, $timeout = 0)
{
if ('127.0.0.1' == $host && 6379 == $port) {
$this->connected = true;
return true;
}
return false;
}
/**
* Set client option.
*
* @param int $name
* @param int $value
*
* @return bool
*/
public function setOption($name, $value)
{
if (!$this->connected) {
return false;
}
return true;
}
/**
* Verify if the specified key exists.
*
* @param string $key
*
* @return bool
*/
public function exists($key)
{
if (!$this->connected) {
return false;
}
return isset($this->storage[$key]);
}
/**
* Store data at the server with expiration time.
*
* @param string $key
* @param int $ttl
* @param mixed $value
*
* @return bool
*/
public function setex($key, $ttl, $value)
{
if (!$this->connected) {
return false;
}
$this->storeData($key, $value);
return true;
}
/**
* Sets an expiration time on an item.
*
* @param string $key
* @param int $ttl
*
* @return bool
*/
public function setTimeout($key, $ttl)
{
if (!$this->connected) {
return false;
}
if (isset($this->storage[$key])) {
return true;
}
return false;
}
/**
* Retrieve item from the server.
*
* @param string $key
*
* @return bool
*/
public function get($key)
{
if (!$this->connected) {
return false;
}
return $this->getData($key);
}
/**
* Append data to an existing item.
*
* @param string $key
* @param string $value
*
* @return int Size of the value after the append.
*/
public function append($key, $value)
{
if (!$this->connected) {
return false;
}
if (isset($this->storage[$key])) {
$this->storeData($key, $this->getData($key).$value);
return strlen($this->storage[$key]);
}
return false;
}
/**
* Remove specified keys.
*
* @param string|array $key
*
* @return int
*/
public function delete($key)
{
if (!$this->connected) {
return false;
}
if (is_array($key)) {
$result = 0;
foreach ($key as $k) {
if (isset($this->storage[$k])) {
unset($this->storage[$k]);
++$result;
}
}
return $result;
}
if (isset($this->storage[$key])) {
unset($this->storage[$key]);
return 1;
}
return 0;
}
/**
* Flush all existing items from all databases at the server.
*
* @return bool
*/
public function flushAll()
{
if (!$this->connected) {
return false;
}
$this->storage = array();
return true;
}
/**
* Close Redis server connection.
*
* @return bool
*/
public function close()
{
$this->connected = false;
return true;
}
private function getData($key)
{
if (isset($this->storage[$key])) {
return unserialize($this->storage[$key]);
}
return false;
}
private function storeData($key, $value)
{
$this->storage[$key] = serialize($value);
return true;
}
public function select($dbnum)
{
if (!$this->connected) {
return false;
}
if (0 > $dbnum) {
return false;
}
return true;
}
}