fix tests

This commit is contained in:
Dennis Eichhorn 2023-09-28 01:04:15 +00:00
parent ff3ed81b4a
commit 15a95fb389
3 changed files with 23 additions and 57 deletions

View File

@ -48,37 +48,11 @@ final class ApiController extends Controller
*/ */
public function apiEmailCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void public function apiEmailCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{ {
if (!empty($val = $this->validateEmailCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$email = $this->createEmailFromRequest($request); $email = $this->createEmailFromRequest($request);
$this->createModel($request->header->account, $email, EmailMapper::class, 'email', $request->getOrigin()); $this->createModel($request->header->account, $email, EmailMapper::class, 'email', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $email); $this->createStandardCreateResponse($request, $response, $email);
} }
/**
* Validate email create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @since 1.0.0
*/
private function validateEmailCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['subject'] = !$request->hasData('subject'))) {
return $val;
}
return [];
}
/** /**
* Method to create email from request. * Method to create email from request.
* *

View File

@ -29,7 +29,7 @@ echo $this->data['nav']->render(); ?>
</div> </div>
<div class="tab-content"> <div class="tab-content">
<?php foreach ($mail->l11n as $idx => $l11n) : ?> <?php foreach ($mail->l11n as $idx => $l11n) : ?>
<input type="radio" id="c-tab-<?= $idx; ?>" name="tabular-1" checked> <input type="radio" id="c-tab-<?= $idx; ?>" name="tabular-1"<?= $l11n === $this->response->header->l11n->language ? ' checked' : ''; ?>>
<div class="tab"> <div class="tab">
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">

View File

@ -14,14 +14,6 @@ declare(strict_types=1);
use phpOMS\Uri\UriFactory; use phpOMS\Uri\UriFactory;
/*
$mail = new \phpOMS\Message\Mail\Imap();
$mail->connect('{imap.gmail.com:993/imap/ssl}INBOX', 'dev.orange.management@gmail.com', 'DEV_PASSWORD');
$unseen = $mail->getInboxUnseen();
$seen = $mail->getInboxSeen();
$quota = $mail->getQuota();
*/
$messages = $this->data['templates'] ?? []; $messages = $this->data['templates'] ?? [];
$previous = empty($messages) ? 'messages/dashboard' : 'messages/dashboard?{?}&id=' . \reset($messages)->id . '&ptype=p'; $previous = empty($messages) ? 'messages/dashboard' : 'messages/dashboard?{?}&id=' . \reset($messages)->id . '&ptype=p';
@ -34,29 +26,29 @@ echo $this->data['nav']->render(); ?>
<div class="portlet"> <div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Templates'); ?><i class="lni lni-download download btn end-xs"></i></div> <div class="portlet-head"><?= $this->getHtml('Templates'); ?><i class="lni lni-download download btn end-xs"></i></div>
<table id="profileList" class="default"> <table id="profileList" class="default">
<thead> <thead>
<tr> <tr>
<td><span class="check"><input type="checkbox" name="profile-list"></span> <td><span class="check"><input type="checkbox" name="profile-list"></span>
<td class="wf-100"><?= $this->getHtml('Subject'); ?> <td class="wf-100"><?= $this->getHtml('Subject'); ?>
<td><?= $this->getHtml('Date'); ?> <td><?= $this->getHtml('Date'); ?>
<tbody> <tbody>
<?php $count = 0; <?php $count = 0;
foreach ($messages as $key => $value) : ++$count; foreach ($messages as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/messages/template/single?{?}&id=' . $value->id); ?> $url = UriFactory::build('{/base}/messages/template/single?{?}&id=' . $value->id); ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td><span class="check"><input type="checkbox" name=""></span> <td><span class="check"><input type="checkbox" name=""></span>
<td><a href="<?= $url; ?>"><?= $this->printHtml(empty($value->subject) ? $value->getL11nByLanguage($this->response->header->l11n->language)->subject : $value->subject); ?></a> <td><a href="<?= $url; ?>"><?= $this->printHtml(empty($value->subject) ? $value->getL11nByLanguage($this->response->header->l11n->language)->subject : $value->subject); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->createdAt->format('Y-m-d')); ?></a> <td><a href="<?= $url; ?>"><?= $this->printHtml($value->createdAt->format('Y-m-d')); ?></a>
<?php endforeach; ?> <?php endforeach; ?>
<?php if ($count === 0) : ?> <?php if ($count === 0) : ?>
<tr> <tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?> <td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?> <?php endif; ?>
</table> </table>
</div>
<div class="portlet-foot"> <div class="portlet-foot">
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a> <a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a>
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a> <a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
</div>
</div> </div>
</div> </div>