Make sure we can connect to memcached
This commit is contained in:
parent
0aa750e2c6
commit
1378768ff0
@ -5,23 +5,17 @@ services:
|
||||
test:7:
|
||||
before_script:
|
||||
- sh build/docker_install.sh > /dev/null
|
||||
#- apk add --no-cache php7-apcu php7-memcached php7-phpdbg
|
||||
#- echo '\nextension=apcu.so\nextension=memcached.so' >> /etc/php7/php.ini
|
||||
- curl -sS https://getcomposer.org/installer | php
|
||||
- php composer.phar install --ignore-platform-reqs
|
||||
#image: php:7-alpine
|
||||
image: php:7
|
||||
script:
|
||||
- phpdbg -qrr -- ./vendor/bin/phpunit -c build
|
||||
- phpdbg -qrr -- ./vendor/bin/phpunit --coverage-text --colors=never
|
||||
|
||||
test:7.1:
|
||||
before_script:
|
||||
- sh build/docker_install.sh > /dev/null
|
||||
#- apk add --no-cache php7.1-apcu php7.1-memcached php7.1-phpdbg
|
||||
#- echo '\nextension=apcu.so\nextension=memcached.so' >> /etc/php7.1/php.ini
|
||||
- curl -sS https://getcomposer.org/installer | php
|
||||
- php composer.phar install --ignore-platform-reqs
|
||||
#image: php:7.1-alpine
|
||||
image: php:7.1
|
||||
script:
|
||||
- phpdbg -qrr -- ./vendor/bin/phpunit -c build
|
||||
- phpdbg -qrr -- ./vendor/bin/phpunit --coverage-text --colors=never
|
||||
|
@ -33,14 +33,15 @@ class MemcachedDriver extends AbstractDriver {
|
||||
* @param array $options
|
||||
* @throws CacheException
|
||||
*/
|
||||
public function __construct(array $config = [], array $options = [])
|
||||
public function __construct(
|
||||
array $config = ['host' => '127.0.0.1', 'port' => '11211'],
|
||||
array $options = []
|
||||
)
|
||||
{
|
||||
// @codeCoverageIgnoreStart
|
||||
if ( ! class_exists('Memcached'))
|
||||
{
|
||||
throw new CacheException("Memcached driver requires memcached extensions");
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
try
|
||||
{
|
||||
@ -48,7 +49,6 @@ class MemcachedDriver extends AbstractDriver {
|
||||
$this->conn->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
|
||||
$this->conn->addServer($config['host'], (int) $config['port']);
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
if ( ! empty($options))
|
||||
{
|
||||
$this->conn->setOptions($options);
|
||||
@ -60,7 +60,6 @@ class MemcachedDriver extends AbstractDriver {
|
||||
// match the requirements of the interface
|
||||
throw new CacheException($e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,10 +22,16 @@ class MemcachedDriverTest extends DriverTestBase {
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->driver = new MemcachedDriver([
|
||||
'host' => 'localhost',
|
||||
'port' => '11211',
|
||||
]);
|
||||
$config = [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 11211
|
||||
];
|
||||
if (array_key_exists('MEMCACHED_HOST', $_ENV))
|
||||
{
|
||||
$config['host'] = $_ENV['MEMCACHED_HOST'];
|
||||
}
|
||||
|
||||
$this->driver = new MemcachedDriver($config);
|
||||
$this->driver->flush();
|
||||
}
|
||||
}
|
@ -16,15 +16,12 @@
|
||||
|
||||
namespace Aviat\Banker\Tests;
|
||||
|
||||
use Aviat\Banker\Pool;
|
||||
use Aviat\Banker\Item;
|
||||
use Aviat\Banker\ItemCollection;
|
||||
use Aviat\Banker\{Item, ItemCollection, Pool};
|
||||
use Aviat\Banker\Exception\InvalidArgumentException;
|
||||
use Monolog\Logger;
|
||||
use Monolog\Handler\SyslogHandler;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
use Psr\Log\{LoggerInterface, NullLogger};
|
||||
|
||||
class PoolTest extends TestCase {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user