/**
  * Tests field name
  *
  * @param string $name       Name
  * @param string $resultName Result name
  *
  * @dataProvider dataName
  */
 public function testName($name, $resultName)
 {
     $this->annotation->expects($this->any())->method('getClass')->will($this->returnValue('Mmoreram\\ControllerExtraBundle\\Tests\\FakeBundle\\Entity\\Fake'));
     $this->annotation->expects($this->any())->method('getName')->will($this->returnValue($name));
     $this->attributes->expects($this->once())->method('set')->with($this->equalTo($resultName), $this->isInstanceOf('Mmoreram\\ControllerExtraBundle\\Tests\\FakeBundle\\Entity\\Fake'));
     $this->entityAnnotationResolver->evaluateAnnotation($this->request, $this->annotation, $this->reflectionMethod);
 }
 public function testProcess()
 {
     $servers = [['host' => '127.0.0.1', 'port' => 6379], ['host' => 'localhost', 'port' => 6380, 'master' => true]];
     $this->containerMock->expects($this->at(0))->method('hasParameter')->with('cache.redis.servers')->will($this->returnValue(true));
     $this->containerMock->expects($this->at(1))->method('getDefinition')->with('igniter.elasticache.rediscache')->will($this->returnValue($this->definitionMock));
     $this->containerMock->expects($this->at(2))->method('getParameterBag')->will($this->returnValue($this->paramterBagMock));
     $this->containerMock->expects($this->at(3))->method('getParameter')->with('igniter.elasticache.redis_class')->will($this->returnValue('Redis'));
     $this->containerMock->expects($this->at(4))->method('getParameter')->with('cache.redis.servers')->will($this->returnValue($servers));
     // look up redis class param
     $this->paramterBagMock->expects($this->at(0))->method('resolveValue')->will($this->returnValue('Redis'));
     // look up servers param
     $this->paramterBagMock->expects($this->at(1))->method('resolveValue')->will($this->returnValue($servers));
     // setMaster and addSlave calls
     $this->definitionMock->expects($this->at(0))->method('addMethodCall')->with('addSlave', $this->callback(function ($subject) {
         // verify the subject is an array of 1 Defintion class
         if (count($subject) != 1 && !is_a($subject[0], 'Symfony\\Component\\DependencyInjection\\Definition')) {
             return false;
         }
         /** @var $definition \Symfony\Component\DependencyInjection\Definition */
         $definition = $subject[0];
         // verify the connect call
         if ($definition->getMethodCalls() !== [['connect', ['127.0.0.1', 6379]]]) {
             return false;
         }
         return true;
     }));
     $this->definitionMock->expects($this->at(1))->method('addMethodCall')->with('setMaster', $this->callback(function ($subject) {
         // verify the subject is an array of 1 Defintion class
         if (count($subject) != 1 && !is_a($subject[0], 'Symfony\\Component\\DependencyInjection\\Definition')) {
             return false;
         }
         /** @var $definition \Symfony\Component\DependencyInjection\Definition */
         $definition = $subject[0];
         // verify the connect call
         if ($definition->getMethodCalls() !== [['connect', ['localhost', 6380]]]) {
             return false;
         }
         return true;
     }));
     $compiler = new RedisCompiler();
     $compiler->process($this->containerMock);
 }