Browse Source

[tests] Add tests for OOB commands inside a pipeline context.

Daniele Alessandri 13 years ago
parent
commit
6e13a8af44
1 changed files with 19 additions and 0 deletions
  1. 19 0
      tests/Predis/Pipeline/PipelineContextTest.php

+ 19 - 0
tests/Predis/Pipeline/PipelineContextTest.php

@@ -307,6 +307,25 @@ class PipelineContextTest extends StandardTestCase
         $this->assertTrue($client->exists('foo'));
     }
 
+    /**
+     * @group connected
+     */
+    public function testOutOfBandMessagesInsidePipeline()
+    {
+        $oob = null;
+        $client = $this->getClient();
+
+        $results = $client->pipeline(function($pipe) use(&$oob) {
+            $pipe->set('foo', 'bar');
+            $oob = $pipe->getClient()->echo('oob message');
+            $pipe->get('foo');
+        });
+
+        $this->assertSame(array(true, 'bar'), $results);
+        $this->assertSame('oob message', $oob);
+        $this->assertTrue($client->exists('foo'));
+    }
+
     /**
      * @group connected
      */