Browse Source

Fix test to handle different hashes generated on 64bits builds of PHP.

Just noticed it on Travis CI as they recently switched to 64bits PHP builds,
also great to see that the library seems to work fine anyway.
Daniele Alessandri 12 years ago
parent
commit
e2e809c9d4
1 changed files with 3 additions and 1 deletions
  1. 3 1
      tests/Predis/Cluster/PredisClusterHashStrategyTest.php

+ 3 - 1
tests/Predis/Cluster/PredisClusterHashStrategyTest.php

@@ -26,7 +26,9 @@ class PredisClusterHashStrategyTest extends StandardTestCase
      */
      */
     public function testSupportsKeyTags()
     public function testSupportsKeyTags()
     {
     {
-        $expected = -1938594527;
+        // NOTE: 32 and 64 bits PHP runtimes can produce different hash values.
+        $expected = PHP_INT_SIZE == 4 ? -1938594527 : 2356372769;
+
         $strategy = $this->getHashStrategy();
         $strategy = $this->getHashStrategy();
 
 
         $this->assertSame($expected, $strategy->getKeyHash('{foo}'));
         $this->assertSame($expected, $strategy->getKeyHash('{foo}'));