CredisStandaloneTest.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. require_once dirname(__FILE__).'/CredisTest.php';
  3. class CredisStandaloneTest extends CredisTest
  4. {
  5. protected $useStandalone = TRUE;
  6. /**
  7. * @group UnixSocket
  8. */
  9. public function testInvalidPersistentConnectionOnUnixSocket()
  10. {
  11. $this->credis->close();
  12. $this->credis = new Credis_Client('unix://'.realpath(__DIR__).'/redis.sock',0,null,'persistent');
  13. $this->credis->forceStandalone();
  14. //$this->setExpectedException('CredisException','Persistent connections to UNIX sockets are not supported in standalone mode.');
  15. $this->credis->connect();
  16. $this->assertTrue($this->credis->isConnected());
  17. }
  18. public function testPersistentConnectionsOnStandAloneTcpConnection()
  19. {
  20. $this->credis->close();
  21. $this->credis = new Credis_Client('tcp://'.$this->redisConfig[0]['host'] . ':' . $this->redisConfig[0]['port'] . '/persistent');
  22. $this->credis->forceStandalone();
  23. $this->credis->set('key','value');
  24. $this->assertEquals('value',$this->credis->get('key'));
  25. }
  26. public function testPersistentvsNonPersistent() {$this->assertTrue(true);}
  27. public function testStandAloneArgumentsExtra()
  28. {
  29. $this->assertTrue($this->credis->hMSet('hash', array('field1' => 'value1', 'field2' => 'value2'), 'field3', 'value3'));
  30. $this->assertEquals(array('field1' => 'value1', 'field2' => 'value2', 'field3' =>'value3'), $this->credis->hMGet('hash', array('field1','field2','field3')));
  31. }
  32. public function testStandAloneMultiPipelineThrowsException()
  33. {
  34. $this->setExpectedExceptionShim('CredisException','A pipeline is already in use and only one pipeline is supported.');
  35. $this->credis->pipeline()->pipeline();
  36. }
  37. }