mirror of
https://github.com/predis/predis.git
synced 2026-08-30 12:15:03 +00:00
Add missing tests for Predis\Profile\ServerProfile::defineCommand().
This commit is contained in:
@@ -145,6 +145,34 @@ class ServerProfileTest extends StandardTestCase
|
||||
$this->assertNull($profile->getCommandClass('UNKNOWN'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
public function testDefineCommand()
|
||||
{
|
||||
$profile = ServerProfile::getDefault();
|
||||
$command = $this->getMock('Predis\Command\CommandInterface');
|
||||
|
||||
$profile->defineCommand('mock', get_class($command));
|
||||
|
||||
$this->assertTrue($profile->supportsCommand('mock'));
|
||||
$this->assertTrue($profile->supportsCommand('MOCK'));
|
||||
|
||||
$this->assertSame(get_class($command), $profile->getCommandClass('mock'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
* @expectedException InvalidArgumentException
|
||||
* @expectedExceptionMessage Cannot register 'stdClass' as it is not a valid Redis command
|
||||
*/
|
||||
public function testDefineInvalidCommand()
|
||||
{
|
||||
$profile = ServerProfile::getDefault();
|
||||
|
||||
$profile->defineCommand('mock', 'stdClass');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group disconnected
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user