Ejemplo n.º 1
0
 /**
  * @test
  * @dataProvider typeProvider
  */
 public function create($type)
 {
     $config = [['host' => 'cache1.com', 'port' => 11211]];
     $adapter = Factory::create($config, $type);
     $class = Factory::NAMESPACE_ADAPTERS . $type . Factory::ADAPTER_SUFFIX;
     $this->assertInstanceOf($class, $adapter);
 }
Ejemplo n.º 2
0
 /**
  * @test
  * @dataProvider typeProvider
  */
 public function failedConnection($type)
 {
     $bad_server = ['host' => '127.0.0.1', 'port' => 11211];
     $failed = false;
     $adapter = Factory::create([$bad_server], $type);
     // Ensure failure events are propegated
     $adapter->bindEvent(AdapterInterface::EVENT_QUERY_FAIL, function () use(&$failed) {
         $failed = true;
     });
     $this->assertFalse($adapter->get($this->_key));
     $this->assertTrue($failed);
 }
Ejemplo n.º 3
0
 /**
  * @param string|null $type
  *
  * @return Behance\NBD\Dbal\AdapterInterface
  */
 protected function _getLiveAdapter($type = null)
 {
     $configs = ['master' => $this->_getEnvironmentConfig($type)];
     return Factory::create($configs, $type);
 }