Пример #1
0
 /**
  */
 public function testAction()
 {
     $queryName = uniqid('query');
     list($data, $expected) = $this->prepareDataAndExpected();
     $user = UserEntityProvider::createEntityWithRandomData();
     $request = new Request();
     $request->setMethod(Request::METHOD_GET);
     $request->setQuery(new Parameters(array('q' => $queryName)));
     $this->authControllerPluginMock->expects($this->once())->method('__invoke')->with(null)->will($this->returnSelf());
     $this->authControllerPluginMock->expects($this->once())->method('getUser')->willReturn($user);
     $this->organizationRepoMock->expects($this->once())->method('getTypeAheadResults')->with($queryName, $user)->willReturn($data);
     /** @var JsonModel $result */
     $result = $this->controller->dispatch($request);
     $this->assertResponseStatusCode(Response::STATUS_CODE_200);
     $this->assertSame($expected, $result->getVariables());
 }