public function testCreateSession() { //Пусть сразу вошли на /#/game и пытаемся отправить ответ //(для простоты тестирования есть тестовая форма /answer) U::get('/answer', $client, $crawler, $html, $json); $form = $crawler->selectButton('Send')->form(array('answer_id' => 4, 'quest_id' => 5)); $client->submit($form); $response = $client->getResponse(); $jsonResponseData = json_decode($response->getContent()); $this->assertTrue($jsonResponseData->info == 'Lost session'); //А теперь сначала создадим пользователя ATL::createUser($userJson, $repository, $username, $em, $client); //Пробуем ответить на вопрос U::get('/answer', $client, $crawler, $html, $json); $form = $crawler->selectButton('Send')->form(array('answer_id' => 4, 'quest_id' => 5)); $client->submit($form); $response = $client->getResponse(); $jsonResponseData = json_decode($response->getContent()); $this->assertTrue(@$jsonResponseData->info != 'Lost session'); $this->assertTrue(@$jsonResponseData->info == 'Answer #4 not found!'); ATL::deleteUser($em, $userJson->id); }
private function _getExistsQuestions($lim = 10) { $client = static::createClient(); U::getEnvParam($client, $em, $r, 'SkyengTT\\SkyengTTBundle\\Entity\\Vocabulary'); return $r->findBy([], ['id' => 'ASC'], $lim, 0); }