Browse Source

[tests] Missing test case for redis-cluster strategy.

Daniele Alessandri 8 years ago
parent
commit
0b226ff1d5
2 changed files with 13 additions and 3 deletions
  1. 2 3
      src/Cluster/RedisStrategy.php
  2. 11 0
      tests/Predis/Cluster/RedisStrategyTest.php

+ 2 - 3
src/Cluster/RedisStrategy.php

@@ -51,8 +51,7 @@ class RedisStrategy extends ClusterStrategy
      */
     public function getDistributor()
     {
-        throw new NotSupportedException(
-            'This cluster strategy does not provide an external distributor'
-        );
+        $class = get_class($this);
+        throw new NotSupportedException("$class does not provide an external distributor");
     }
 }

+ 11 - 0
tests/Predis/Cluster/RedisStrategyTest.php

@@ -292,6 +292,17 @@ class RedisStrategyTest extends PredisTestCase
         $this->assertNotNull($strategy->getSlot($command));
     }
 
+    /**
+     * @group disconnected
+     * @expectedException \Predis\NotSupportedException
+     * @expectedExceptionMessage Predis\Cluster\RedisStrategy does not provide an external distributor
+     */
+    public function testThrowsExceptionOnGetDistributorMethod()
+    {
+        $strategy = $this->getClusterStrategy();
+        $strategy->getDistributor();
+    }
+
     // ******************************************************************** //
     // ---- HELPER METHODS ------------------------------------------------ //
     // ******************************************************************** //