public function testCallMethod()
 {
     $managerName = 'fooManager';
     $methodName = 'fooMethod';
     $params = array('foo' => 'bar');
     $changeState = true;
     $payload = $this->getMock('InoPerunApi\\Client\\Payload');
     $response = $this->createResponseMock();
     $response->expects($this->once())->method('getPayload')->will($this->returnValue($payload));
     $client = $this->createClientMock();
     $client->expects($this->once())->method('sendRequest')->with($managerName, $methodName, $params, $changeState)->will($this->returnValue($response));
     $this->manager->setClient($client);
     $entity = $this->getMock('InoPerunApi\\Entity\\EntityInterface');
     $entityFactory = $this->getMock('InoPerunApi\\Entity\\Factory\\FactoryInterface');
     $entityFactory->expects($this->once())->method('createFromResponsePayload')->with($payload)->will($this->returnValue($entity));
     $this->manager->setEntityFactory($entityFactory);
     $this->manager->setManagerName($managerName);
     $entity = $this->manager->callMethod($methodName, $params, $changeState);
 }