mirror of
https://github.com/predis/predis.git
synced 2026-10-08 04:46:38 +00:00
use short array syntax
This commit is contained in:
@@ -30,7 +30,7 @@ class ScriptCommandTest extends PredisTestCase
|
||||
{
|
||||
/** @var CommandInterface */
|
||||
$command = $this->getMockBuilder('Predis\Command\ScriptCommand')
|
||||
->onlyMethods(array('getScript'))
|
||||
->onlyMethods(['getScript'])
|
||||
->getMock();
|
||||
|
||||
$this->assertSame('EVALSHA', $command->getId());
|
||||
@@ -43,7 +43,7 @@ class ScriptCommandTest extends PredisTestCase
|
||||
{
|
||||
/** @var ScriptCommand|MockObject */
|
||||
$command = $this->getMockBuilder('Predis\Command\ScriptCommand')
|
||||
->onlyMethods(array('getScript', 'getKeysCount'))
|
||||
->onlyMethods(['getScript', 'getKeysCount'])
|
||||
->getMock();
|
||||
$command
|
||||
->expects($this->exactly(2))
|
||||
@@ -54,7 +54,7 @@ class ScriptCommandTest extends PredisTestCase
|
||||
->method('getKeysCount')
|
||||
->willReturn(2);
|
||||
|
||||
$command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2'));
|
||||
$command->setArguments($arguments = ['key1', 'key2', 'value1', 'value2']);
|
||||
|
||||
$this->assertSame(self::LUA_SCRIPT_SHA1, $command->getScriptHash());
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class ScriptCommandTest extends PredisTestCase
|
||||
{
|
||||
/** @var ScriptCommand|MockObject */
|
||||
$command = $this->getMockBuilder('Predis\Command\ScriptCommand')
|
||||
->onlyMethods(array('getScript', 'getKeysCount'))
|
||||
->onlyMethods(['getScript', 'getKeysCount'])
|
||||
->getMock();
|
||||
$command
|
||||
->expects($this->once())
|
||||
@@ -77,9 +77,9 @@ class ScriptCommandTest extends PredisTestCase
|
||||
->method('getKeysCount')
|
||||
->willReturn(2);
|
||||
|
||||
$command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2'));
|
||||
$command->setArguments($arguments = ['key1', 'key2', 'value1', 'value2']);
|
||||
|
||||
$this->assertSame(array('key1', 'key2'), $command->getKeys());
|
||||
$this->assertSame(['key1', 'key2'], $command->getKeys());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,16 +89,16 @@ class ScriptCommandTest extends PredisTestCase
|
||||
{
|
||||
/** @var ScriptCommand|MockObject */
|
||||
$command = $this->getMockBuilder('Predis\Command\ScriptCommand')
|
||||
->onlyMethods(array('getScript'))
|
||||
->onlyMethods(['getScript'])
|
||||
->getMock();
|
||||
$command
|
||||
->expects($this->once())
|
||||
->method('getScript')
|
||||
->willReturn(self::LUA_SCRIPT);
|
||||
|
||||
$command->setArguments($arguments = array('value1', 'value2', 'value3'));
|
||||
$command->setArguments($arguments = ['value1', 'value2', 'value3']);
|
||||
|
||||
$this->assertSame(array(), $command->getKeys());
|
||||
$this->assertSame([], $command->getKeys());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,7 +108,7 @@ class ScriptCommandTest extends PredisTestCase
|
||||
{
|
||||
/** @var ScriptCommand|MockObject */
|
||||
$command = $this->getMockBuilder('Predis\Command\ScriptCommand')
|
||||
->onlyMethods(array('getScript', 'getKeysCount'))
|
||||
->onlyMethods(['getScript', 'getKeysCount'])
|
||||
->getMock();
|
||||
$command
|
||||
->expects($this->once())
|
||||
@@ -119,9 +119,9 @@ class ScriptCommandTest extends PredisTestCase
|
||||
->method('getKeysCount')
|
||||
->willReturn(-2);
|
||||
|
||||
$command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2'));
|
||||
$command->setArguments($arguments = ['key1', 'key2', 'value1', 'value2']);
|
||||
|
||||
$this->assertSame(array('key1', 'key2'), $command->getKeys());
|
||||
$this->assertSame(['key1', 'key2'], $command->getKeys());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,7 +131,7 @@ class ScriptCommandTest extends PredisTestCase
|
||||
{
|
||||
/** @var ScriptCommand|MockObject */
|
||||
$command = $this->getMockBuilder('Predis\Command\ScriptCommand')
|
||||
->onlyMethods(array('getScript', 'getKeysCount'))
|
||||
->onlyMethods(['getScript', 'getKeysCount'])
|
||||
->getMock();
|
||||
$command
|
||||
->expects($this->once())
|
||||
@@ -142,9 +142,9 @@ class ScriptCommandTest extends PredisTestCase
|
||||
->method('getKeysCount')
|
||||
->willReturn(2);
|
||||
|
||||
$command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2'));
|
||||
$command->setArguments($arguments = ['key1', 'key2', 'value1', 'value2']);
|
||||
|
||||
$this->assertSame(array_merge(array(self::LUA_SCRIPT_SHA1, 2), $arguments), $command->getArguments());
|
||||
$this->assertSame(array_merge([self::LUA_SCRIPT_SHA1, 2], $arguments), $command->getArguments());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,16 +154,16 @@ class ScriptCommandTest extends PredisTestCase
|
||||
{
|
||||
/** @var ScriptCommand|MockObject */
|
||||
$command = $this->getMockBuilder('Predis\Command\ScriptCommand')
|
||||
->onlyMethods(array('getScript', 'getKeysCount'))
|
||||
->onlyMethods(['getScript', 'getKeysCount'])
|
||||
->getMock();
|
||||
$command
|
||||
->expects($this->once())
|
||||
->method('getScript')
|
||||
->willReturn(self::LUA_SCRIPT);
|
||||
|
||||
$command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2'));
|
||||
$command->setArguments($arguments = ['key1', 'key2', 'value1', 'value2']);
|
||||
|
||||
$this->assertSame(array_merge(array(self::LUA_SCRIPT_SHA1, 0), $arguments), $command->getArguments());
|
||||
$this->assertSame(array_merge([self::LUA_SCRIPT_SHA1, 0], $arguments), $command->getArguments());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,7 +173,7 @@ class ScriptCommandTest extends PredisTestCase
|
||||
{
|
||||
/** @var ScriptCommand|MockObject */
|
||||
$command = $this->getMockBuilder('Predis\Command\ScriptCommand')
|
||||
->onlyMethods(array('getScript', 'getKeysCount'))
|
||||
->onlyMethods(['getScript', 'getKeysCount'])
|
||||
->getMock();
|
||||
$command
|
||||
->expects($this->once())
|
||||
@@ -184,9 +184,9 @@ class ScriptCommandTest extends PredisTestCase
|
||||
->method('getKeysCount')
|
||||
->willReturn(-2);
|
||||
|
||||
$command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2'));
|
||||
$command->setArguments($arguments = ['key1', 'key2', 'value1', 'value2']);
|
||||
|
||||
$this->assertSame(array_merge(array(self::LUA_SCRIPT_SHA1, 2), $arguments), $command->getArguments());
|
||||
$this->assertSame(array_merge([self::LUA_SCRIPT_SHA1, 2], $arguments), $command->getArguments());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,7 +196,7 @@ class ScriptCommandTest extends PredisTestCase
|
||||
{
|
||||
/** @var ScriptCommand|MockObject */
|
||||
$command = $this->getMockBuilder('Predis\Command\ScriptCommand')
|
||||
->onlyMethods(array('getScript', 'getKeysCount'))
|
||||
->onlyMethods(['getScript', 'getKeysCount'])
|
||||
->getMock();
|
||||
$command
|
||||
->expects($this->exactly(2))
|
||||
@@ -207,9 +207,9 @@ class ScriptCommandTest extends PredisTestCase
|
||||
->method('getKeysCount')
|
||||
->willReturn(2);
|
||||
|
||||
$command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2'));
|
||||
$command->setArguments($arguments = ['key1', 'key2', 'value1', 'value2']);
|
||||
|
||||
$this->assertSame(array_merge(array(self::LUA_SCRIPT, 2), $arguments), $command->getEvalArguments());
|
||||
$this->assertSame(array_merge([self::LUA_SCRIPT, 2], $arguments), $command->getEvalArguments());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,7 +219,7 @@ class ScriptCommandTest extends PredisTestCase
|
||||
{
|
||||
/** @var ScriptCommand|MockObject */
|
||||
$command = $this->getMockBuilder('Predis\Command\ScriptCommand')
|
||||
->onlyMethods(array('getScript', 'getKeysCount'))
|
||||
->onlyMethods(['getScript', 'getKeysCount'])
|
||||
->getMock();
|
||||
$command
|
||||
->expects($this->exactly(2))
|
||||
@@ -230,9 +230,9 @@ class ScriptCommandTest extends PredisTestCase
|
||||
->method('getKeysCount')
|
||||
->willReturn(2);
|
||||
|
||||
$command->setArguments($arguments = array('key1', 'key2', 'value1', 'value2'));
|
||||
$command->setArguments($arguments = ['key1', 'key2', 'value1', 'value2']);
|
||||
|
||||
$evalCMD = new RawCommand('EVAL', array_merge(array(self::LUA_SCRIPT, 2), $arguments));
|
||||
$evalCMD = new RawCommand('EVAL', array_merge([self::LUA_SCRIPT, 2], $arguments));
|
||||
|
||||
$this->assertRedisCommand($evalCMD, $command->getEvalCommand());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user