Skip to content
Snippets Groups Projects
Commit 3b8c908f authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

FEAT #11277 TIME 1:00 Added unit test for autocomplete tags

parent 123b8fd7
No related branches found
No related tags found
No related merge requests found
...@@ -314,4 +314,29 @@ class AutocompleteControllerTest extends TestCase ...@@ -314,4 +314,29 @@ class AutocompleteControllerTest extends TestCase
$this->assertSame('Bad Request', $responseBody->errors); $this->assertSame('Bad Request', $responseBody->errors);
} }
public function testGetTags()
{
$autocompleteController = new \SrcCore\controllers\AutoCompleteController();
// CREATE
$environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'GET']);
$request = \Slim\Http\Request::createFromEnvironment($environment);
$aArgs = [
'search' => 'maa'
];
$fullRequest = $request->withQueryParams($aArgs);
$response = $autocompleteController->getTags($fullRequest, new \Slim\Http\Response());
$responseBody = json_decode((string)$response->getBody());
$this->assertInternalType('array', $responseBody);
$this->assertNotEmpty($responseBody);
$this->assertInternalType('int', $responseBody[0]->id);
$this->assertNotEmpty($responseBody[0]->id);
$this->assertInternalType('string', $responseBody[0]->idToDisplay);
$this->assertNotEmpty($responseBody[0]->idToDisplay);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment