Browse Source

[tests] Improve assert failure messages for replication stategy tests.

Daniele Alessandri 10 years ago
parent
commit
30d01c40d4
1 changed files with 23 additions and 5 deletions
  1. 23 5
      tests/Predis/Replication/ReplicationStrategyTest.php

+ 23 - 5
tests/Predis/Replication/ReplicationStrategyTest.php

@@ -29,7 +29,11 @@ class ReplicationStrategyTest extends PredisTestCase
 
 
         foreach ($this->getExpectedCommands('read') as $commandId) {
         foreach ($this->getExpectedCommands('read') as $commandId) {
             $command = $profile->createCommand($commandId);
             $command = $profile->createCommand($commandId);
-            $this->assertTrue($strategy->isReadOperation($command));
+
+            $this->assertTrue(
+                $strategy->isReadOperation($command),
+                "$commandId is expected to be a read operation."
+            );
         }
         }
     }
     }
 
 
@@ -43,7 +47,11 @@ class ReplicationStrategyTest extends PredisTestCase
 
 
         foreach ($this->getExpectedCommands('write') as $commandId) {
         foreach ($this->getExpectedCommands('write') as $commandId) {
             $command = $profile->createCommand($commandId);
             $command = $profile->createCommand($commandId);
-            $this->assertFalse($strategy->isReadOperation($command), $commandId);
+
+            $this->assertFalse(
+                $strategy->isReadOperation($command),
+                "$commandId is expected to be a write operation."
+            );
         }
         }
     }
     }
 
 
@@ -57,7 +65,11 @@ class ReplicationStrategyTest extends PredisTestCase
 
 
         foreach ($this->getExpectedCommands('disallowed') as $commandId) {
         foreach ($this->getExpectedCommands('disallowed') as $commandId) {
             $command = $profile->createCommand($commandId);
             $command = $profile->createCommand($commandId);
-            $this->assertTrue($strategy->isDisallowedOperation($command), $commandId);
+
+            $this->assertTrue(
+                $strategy->isDisallowedOperation($command),
+                "$commandId is expected to be a disallowed operation."
+            );
         }
         }
     }
     }
 
 
@@ -70,10 +82,16 @@ class ReplicationStrategyTest extends PredisTestCase
         $strategy = new ReplicationStrategy();
         $strategy = new ReplicationStrategy();
 
 
         $cmdReadSort = $profile->createCommand('SORT', array('key:list'));
         $cmdReadSort = $profile->createCommand('SORT', array('key:list'));
-        $this->assertTrue($strategy->isReadOperation($cmdReadSort), 'SORT [read-only]');
+        $this->assertTrue(
+            $strategy->isReadOperation($cmdReadSort),
+            'SORT is expected to be a read operation.'
+        );
 
 
         $cmdWriteSort = $profile->createCommand('SORT', array('key:list', array('store' => 'key:stored')));
         $cmdWriteSort = $profile->createCommand('SORT', array('key:list', array('store' => 'key:stored')));
-        $this->assertFalse($strategy->isReadOperation($cmdWriteSort), 'SORT [write with STORE]');
+        $this->assertFalse(
+            $strategy->isReadOperation($cmdWriteSort),
+            'SORT with STORE is expected to be a write operation.'
+        );
     }
     }
 
 
     /**
     /**