Skip to content
Snippets Groups Projects
Verified Commit cce733e7 authored by Florian Azizian's avatar Florian Azizian
Browse files

FEAT #146 & #147 TU history and historyBatch

parent 5a192c66
No related branches found
No related tags found
No related merge requests found
<?php
/**
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
*
*/
use PHPUnit\Framework\TestCase;
class HistoryControllerTest extends TestCase
{
public function testGetHistoryByUserId()
{
$environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'GET']);
$request = \Slim\Http\Request::createFromEnvironment($environment);
$history = new \History\controllers\HistoryController();
$response = $history->getByUserId($request, new \Slim\Http\Response(), ['userSerialId' => 1]);
$responseBody = json_decode((string)$response->getBody());
$this->assertNotNull($responseBody->histories);
}
public function testGetHistory()
{
$environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'GET']);
$request = \Slim\Http\Request::createFromEnvironment($environment);
$history = new \History\controllers\HistoryController();
$response = $history->get($request, new \Slim\Http\Response(), ['date' => '2018-01-02']);
$responseBody = json_decode((string)$response->getBody());
$this->assertNotNull($responseBody->filters->users);
$this->assertNotNull($responseBody->filters->eventType);
$this->assertNotNull($responseBody->historyList);
}
public function testGetHistoryBatch()
{
$environment = \Slim\Http\Environment::mock(['REQUEST_METHOD' => 'GET']);
$request = \Slim\Http\Request::createFromEnvironment($environment);
$historyBatch = new \History\controllers\HistoryBatchController();
$response = $historyBatch->get($request, new \Slim\Http\Response(), ['date' => '2018-01-02']);
$responseBody = json_decode((string)$response->getBody());
$this->assertNotNull($responseBody->filters->modules);
$this->assertNotNull($responseBody->historyList);
}
}
......@@ -6,9 +6,9 @@
<file>core/Test/ActionControllerTest.php</file>
<file>core/Test/BasketControllerTest.php</file>
<file>core/Test/ContactControllerTest.php</file>
<file>core/Test/DoctypeControllerTest.php</file>
<file>core/Test/EntityControllerTest.php</file>
<file>core/Test/ListTemplateControllerTest.php</file>
<file>core/Test/DoctypeControllerTest.php</file>
<file>core/Test/NotificationControllerTest.php</file>
<file>core/Test/NotificationScheduleControllerTest.php</file>
<file>core/Test/ParameterControllerTest.php</file>
......@@ -21,6 +21,8 @@
<file>modules/convert/Test/ProcessFulltextTest.php</file>
<file>modules/convert/Test/ProcessManageConvertTest.php</file>
<file>modules/convert/Test/ProcessThumbnailsTest.php</file>
<!-- The last one should be history -->
<file>core/Test/HistoryControllerTest.php</file>
</testsuite>
</testsuites>
<filter>
......
......@@ -14,7 +14,7 @@
namespace History\controllers;
use Core\Models\ServiceModel;
use Group\models\ServiceModel;
use History\models\HistoryBatchModel;
use Slim\Http\Request;
use Slim\Http\Response;
......
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