From 096ed5ea2e6309ce2f484ece0db964c5cc740b64 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 17 Feb 2020 08:55:10 +0100 Subject: update to 5.2.0RC1 --- RedisSentinelTest.php | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 RedisSentinelTest.php (limited to 'RedisSentinelTest.php') diff --git a/RedisSentinelTest.php b/RedisSentinelTest.php new file mode 100644 index 0000000..b88e006 --- /dev/null +++ b/RedisSentinelTest.php @@ -0,0 +1,113 @@ +getHost()); + } + + public function setUp() + { + $this->sentinel = $this->newInstance(); + } + + public function testCkquorum() + { + $this->assertTrue($this->sentinel->ckquorum(self::NAME)); + } + + public function testFailover() + { + $this->assertFalse($this->sentinel->failover(self::NAME)); + } + + public function testFlushconfig() + { + $this->assertTrue($this->sentinel->flushconfig()); + } + + public function testGetMasterAddrByName() + { + $result = $this->sentinel->getMasterAddrByName(self::NAME); + $this->assertTrue(is_array($result)); + $this->assertEquals(2, count($result)); + } + + protected function checkFields(array $fields) + { + foreach ($this->fields as $k) { + $this->assertTrue(array_key_exists($k, $fields)); + } + } + + public function testMaster() + { + $result = $this->sentinel->master(self::NAME); + $this->assertTrue(is_array($result)); + $this->checkFields($result); + } + + public function testMasters() + { + $result = $this->sentinel->masters(); + $this->assertTrue(is_array($result)); + foreach ($result as $master) { + $this->checkFields($master); + } + } + + public function testPing() + { + $this->assertTrue($this->sentinel->ping()); + } + + public function testReset() + { + $this->assertFalse($this->sentinel->reset('*')); + } + + public function testSentinels() + { + $result = $this->sentinel->sentinels(self::NAME); + $this->assertTrue(is_array($result)); + foreach ($result as $sentinel) { + $this->checkFields($sentinel); + } + } + + public function testSlaves() + { + $result = $this->sentinel->slaves(self::NAME); + $this->assertTrue(is_array($result)); + foreach ($result as $slave) { + $this->checkFields($slave); + } + } +} -- cgit