Minor - fix behat test + add behat tests.

pull/3768/head
Julio Montoya 4 years ago
parent eba5fc8f0c
commit b13de8508d
  1. 12
      .github/workflows/php.yml
  2. 34
      public/main/inc/lib/message.lib.php
  3. 2
      public/main/social/group_add.php

@ -195,8 +195,16 @@ jobs:
../../vendor/behat/behat/bin/behat features/sessionManagement.feature -vv
../../vendor/behat/behat/bin/behat features/socialGroup.feature -vv
../../vendor/behat/behat/bin/behat features/systemAnnouncements.feature -vv
../../vendor/behat/behat/bin/behat features/ticket.feature -vv
../../vendor/behat/behat/bin/behat features/toolAgenda.feature -vv
../../vendor/behat/behat/bin/behat features/toolAnnouncement.feature -vv
# ../../vendor/behat/behat/bin/behat features/toolDocument.feature -v
# ../../vendor/behat/behat/bin/behat features/toolExercise.feature -v
# ../../vendor/behat/behat/bin/behat features/toolForum.feature -v
# ../../vendor/behat/behat/bin/behat features/toolGroup.feature -vv
../../vendor/behat/behat/bin/behat features/toolLink.feature -vv
#../../vendor/behat/behat/bin/behat features/toolLp.feature -vvv
../../vendor/behat/behat/bin/behat features/toolWork.feature -vvv
- name: Composer analyse
run: composer analyse

@ -617,6 +617,12 @@ class MessageManager
$table = Database::get_main_table(TABLE_MESSAGE);
$em = Database::getManager();
$repo = $em->getRepository(Message::class);
$parent = null;
if (!empty($parent_id)) {
$parent = $repo->find($parent_id);
}
$message = null;
// Just in case we replace the and \n and \n\r while saving in the DB
@ -631,8 +637,6 @@ class MessageManager
Database::query($query);
$messageId = $editMessageId;
} else {
$repo = $em->getRepository(Message::class);
$parent = $repo->find($parent_id);
$message = new Message();
$message
->setUserSender($userSender)
@ -649,7 +653,6 @@ class MessageManager
}
// Forward also message attachments.
$forwardAttachments = [];
if (!empty($forwardId)) {
$forwardMessage = $repo->find($forwardId);
if (null !== $forwardMessage) {
@ -681,18 +684,19 @@ class MessageManager
// Save message in the outbox for user friend or group.
if (empty($group_id) && MESSAGE_STATUS_UNREAD === $status) {
$params = [
'user_sender_id' => $user_sender_id,
'user_receiver_id' => $receiverUserId,
'msg_status' => MESSAGE_STATUS_OUTBOX,
'send_date' => $now,
'title' => $subject,
'content' => $content,
'group_id' => $group_id,
'parent_id' => $parent_id,
'update_date' => $now,
];
Database::insert($table, $params);
$message = new Message();
$message
->setUserSender($userSender)
->setUserReceiver($userRecipient)
->setMsgStatus(MESSAGE_STATUS_OUTBOX)
->setTitle($subject)
->setContent($content)
->setGroupId($group_id)
->setParent($parent)
;
$em->persist($message);
$em->flush();
$messageId = $message->getId();
// save attachment file for outbox messages
/*if (is_array($attachmentList)) {

@ -21,7 +21,7 @@ $table_message = Database::get_main_table(TABLE_MESSAGE);
$usergroup = new UserGroup();
$form = new FormValidator('add_group');
$usergroup->setGroupType($usergroup::SOCIAL_CLASS);
$usergroup->setForm($form, 'add', []);
$usergroup->setForm($form, 'add');
if ($form->validate()) {
$values = $form->exportValues();

Loading…
Cancel
Save