Beispiel #1
0
 /**
  * Can it get the proper config array?
  *
  * @test
  */
 public function it_gets_config_values()
 {
     $expectedConfig = ['cluster' => false, 'default' => ['host' => $this->masters[0]['host'], 'port' => $this->masters[0]['port']]];
     Config::shouldReceive('get')->once()->with('database.redis.nodeSetName')->andReturn('node-set');
     Config::shouldReceive('get')->once()->with('database.redis.masters')->andReturn($this->masters);
     Config::shouldReceive('get')->with('database.redis.backoff-strategy')->andReturn($this->backOffStrategy);
     Config::shouldReceive('get')->with('database.redis.cluster')->andReturn(false);
     $this->HAClient->shouldReceive('getIpAddress')->once()->andReturn($this->masters[0]['host']);
     $this->HAClient->shouldReceive('getPort')->once()->andReturn($this->masters[0]['port']);
     $this->driverUnderTest = new Driver();
     $configUnderTest = $this->driverUnderTest->getConfig();
     $this->assertEquals($expectedConfig, $configUnderTest);
 }
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     if ($this->shouldProvidePSRedis()) {
         $this->app->bindShared('redis', function () {
             $driver = new Driver();
             return new Database($driver->getConfig());
         });
     }
 }