/** * @group disconnected */ public function testConstructorWithExecutorArgument() { $client = new Client(); $executor = $this->getMock('Predis\\Pipeline\\PipelineExecutorInterface'); $pipeline = new PipelineContext($client, $executor); $this->assertSame($executor, $pipeline->getExecutor()); }
/** * @group disconnected */ public function testConstructorWithOptions() { $client = new Client(); $executor = $this->getMock('Predis\\Pipeline\\IPipelineExecutor'); $pipeline = new PipelineContext($client, array('executor' => $executor)); $this->assertSame($executor, $pipeline->getExecutor()); $pipeline = new PipelineContext($client, array('safe' => true)); $this->assertInstanceOf('Predis\\Pipeline\\SafeExecutor', $pipeline->getExecutor()); $options = array('executor' => 'safe'); $client = new Client($this->getMock('Predis\\Network\\IConnectionCluster')); $pipeline = new PipelineContext($client, array('safe' => true)); $this->assertInstanceOf('Predis\\Pipeline\\SafeClusterExecutor', $pipeline->getExecutor()); }