/**
  * @covers Pcelta\Doctrine\Cache\Factory\Memcache::create
  */
 public function testCreateShouldReturnMemcacheInstance()
 {
     $params = ['host' => '127.0.0.1', 'port' => 11211, 'adapter_name' => 'Any', 'is_connectable' => true];
     $config = new \Pcelta\Doctrine\Cache\Entity\Config($params);
     $factory = new Memcache();
     if (!extension_loaded(Memcache::MODULE_NAME)) {
         $this->markTestSkipped('Memcache Module Is Not Installed');
         return;
     }
     $result = $factory->create($config);
     $this->assertInstanceOf('\\Memcache', $result);
 }
Ejemplo n.º 2
0
 /**
  * @param Config $config
  *
  * @return \Memcache
  *
  * @throws ModuleIsNotInstalled
  */
 public function create(Config $config)
 {
     $memcache = new \Memcache();
     $memcache->connect($config->getHost(), $config->getPort());
     return $memcache;
 }