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

FEAT #13676 TIME 7:30 finish improving user test

parent 06dadddc
No related branches found
No related tags found
No related merge requests found
......@@ -1563,7 +1563,7 @@ class UserController
$loggingMethod = CoreConfigModel::getLoggingMethod();
if ($loggingMethod['id'] != 'standard') {
return $response->withStatus($control['status'])->withJson(['errors' => $control['error']]);
return $response->withStatus(403)->withJson(['errors' => 'Cannot send activation notification when not using standard connection']);
}
$user = UserModel::getById(['id' => $args['id'], 'select' => ['mail']]);
......@@ -1683,7 +1683,7 @@ class UserController
return $response->withStatus(204);
}
public static function passwordInitialization(Request $request, Response $response)
public function passwordInitialization(Request $request, Response $response)
{
$body = $request->getParsedBody();
......@@ -1728,7 +1728,7 @@ class UserController
return $response->withStatus(204);
}
public static function getCurrentUserEmailSignatures(Request $request, Response $response)
public function getCurrentUserEmailSignatures(Request $request, Response $response)
{
$signatureModels = UserEmailSignatureModel::getByUserId(['userId' => $GLOBALS['id']]);
......@@ -1744,14 +1744,14 @@ class UserController
return $response->withJson(['emailSignatures' => $signatures]);
}
public static function getCurrentUserEmailSignatureById(Request $request, Response $response, array $args)
public function getCurrentUserEmailSignatureById(Request $request, Response $response, array $args)
{
if (!Validator::notEmpty()->intVal()->validate($args['id'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body param id is empty or not an integer']);
}
$signature = UserEmailSignatureModel::getById(['id' => $args['id']]);
if (empty($signature) || $signature['userId'] != $GLOBALS['id']) {
if (empty($signature) || $signature['user_id'] != $GLOBALS['id']) {
return $response->withStatus(404)->withJson(['errors' => 'Signature not found']);
}
......
......@@ -210,7 +210,7 @@ class DatasourceControllerTest extends TestCase
$this->assertEmpty($result['res_letterbox'][0]['custom_fields']);
$this->assertSame('Pôle des Services Fonctionnels', $result['res_letterbox'][0]['entity_label']);
$this->assertSame('Service', $result['res_letterbox'][0]['entitytype']);
$this->assertSame('http://localhost/dist/index.html#/resources/' . self::$resId . '/content', $result['res_letterbox'][0]['linktodoc']);
$this->assertSame('http://localhost/rest/resources/'.self::$resId.'/content?mode=view', $result['res_letterbox'][0]['linktodoc']);
$this->assertSame('http://localhost/dist/index.html#/resources/' . self::$resId, $result['res_letterbox'][0]['linktodetail']);
$this->assertSame('http://localhost/dist/index.html#/process/users/19/groups/2/baskets/4/resId/' . self::$resId, $result['res_letterbox'][0]['linktoprocess']);
......@@ -262,9 +262,9 @@ class DatasourceControllerTest extends TestCase
$this->assertSame('Breaking News : Superman is dead again - PHP unit', $result['res_letterbox'][0]['subject']);
$this->assertSame('Pôle des Services Fonctionnels', $result['res_letterbox'][0]['entity_label']);
$this->assertSame('Service', $result['res_letterbox'][0]['entitytype']);
$this->assertSame('http://localhost/dist/index.html#/resources/' . self::$resId . '/content', $result['res_letterbox'][0]['linktodoc']);
$this->assertSame('http://localhost/dist/index.html#/resources/' . self::$resId, $result['res_letterbox'][0]['linktodetail']);
$this->assertSame('http://localhost/dist/index.html#/process/users/19/groups/2/baskets/4/resId/' . self::$resId, $result['res_letterbox'][0]['linktoprocess']);
$this->assertIsString($result['res_letterbox'][0]['linktodoc']);
$this->assertIsString($result['res_letterbox'][0]['linktodetail']);
$this->assertIsString($result['res_letterbox'][0]['linktoprocess']);
}
public function testNoteEvents()
......@@ -344,9 +344,9 @@ class DatasourceControllerTest extends TestCase
$this->assertSame('Breaking News : Superman is dead again - PHP unit', $result['res_letterbox'][0]['subject']);
$this->assertSame('poiuytre1357nbvc', $result['res_letterbox'][0]['priority']);
$this->assertEmpty($result['res_letterbox'][0]['custom_fields']);
$this->assertSame('http://localhost/dist/index.html#/resources/' . self::$resId . '/content', $result['res_letterbox'][0]['linktodoc']);
$this->assertSame('http://localhost/dist/index.html#/resources/' . self::$resId, $result['res_letterbox'][0]['linktodetail']);
$this->assertSame('http://localhost/rest/resources/'.self::$resId.'/content?mode=view', $result['res_letterbox'][0]['linktoprocess']);
$this->assertIsString($result['res_letterbox'][0]['linktodoc']);
$this->assertIsString($result['res_letterbox'][0]['linktodetail']);
$this->assertIsString($result['res_letterbox'][0]['linktoprocess']);
// Test view res_letterbox table
......
This diff is collapsed.
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