mirror of
https://github.com/Karaka-Management/oms-Kanban.git
synced 2026-02-10 01:08:40 +00:00
remove some getter/setter
This commit is contained in:
parent
44b005a8cd
commit
11bd0bed0d
|
|
@ -63,13 +63,13 @@ final class ApiController extends Controller
|
|||
{
|
||||
if (!empty($val = $this->validateKanbanCardCreate($request))) {
|
||||
$response->set('kanban_card_create', new FormValidation($val));
|
||||
$response->getHeader()->setStatusCode(RequestStatusCode::R_400);
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$card = $this->createKanbanCardFromRequest($request);
|
||||
$this->createModel($request->getHeader()->getAccount(), $card, KanbanCardMapper::class, 'card', $request->getOrigin());
|
||||
$this->createModel($request->header->account, $card, KanbanCardMapper::class, 'card', $request->getOrigin());
|
||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Card', 'Card successfully created.', $card);
|
||||
}
|
||||
|
||||
|
|
@ -85,14 +85,14 @@ final class ApiController extends Controller
|
|||
public function createKanbanCardFromRequest(RequestAbstract $request) : KanbanCard
|
||||
{
|
||||
$card = new KanbanCard();
|
||||
$card->setName((string) ($request->getData('title')));
|
||||
$card->setDescription((string) ($request->getData('plain') ?? ''));
|
||||
$card->name = (string) ($request->getData('title'));
|
||||
$card->description = (string) ($request->getData('plain') ?? '');
|
||||
$card->setColumn((int) $request->getData('column'));
|
||||
$card->setOrder((int) ($request->getData('order') ?? 1));
|
||||
$card->setRef((int) ($request->getData('ref') ?? 0));
|
||||
$card->setStatus((int) ($request->getData('status') ?? CardStatus::ACTIVE));
|
||||
$card->setType((int) ($request->getData('type') ?? CardType::TEXT));
|
||||
$card->setCreatedBy(new NullAccount($request->getHeader()->getAccount()));
|
||||
$card->createdBy = new NullAccount($request->header->account);
|
||||
|
||||
return $card;
|
||||
}
|
||||
|
|
@ -143,13 +143,13 @@ final class ApiController extends Controller
|
|||
{
|
||||
if (!empty($val = $this->validateKanbanCardCommentCreate($request))) {
|
||||
$response->set('kanban_comment_create', new FormValidation($val));
|
||||
$response->getHeader()->setStatusCode(RequestStatusCode::R_400);
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$comment = $this->createKanbanCardCommentFromRequest($request);
|
||||
$this->createModel($request->getHeader()->getAccount(), $comment, KanbanCardCommentMapper::class, 'comment', $request->getOrigin());
|
||||
$this->createModel($request->header->account, $comment, KanbanCardCommentMapper::class, 'comment', $request->getOrigin());
|
||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Card', 'Card successfully created.', $comment);
|
||||
}
|
||||
|
||||
|
|
@ -165,9 +165,9 @@ final class ApiController extends Controller
|
|||
public function createKanbanCardCommentFromRequest(RequestAbstract $request) : KanbanCardComment
|
||||
{
|
||||
$comment = new KanbanCardComment();
|
||||
$comment->setDescription((string) ($request->getData('plain') ?? ''));
|
||||
$comment->description = (string) ($request->getData('plain') ?? '');
|
||||
$comment->setCard((int) $request->getData('card'));
|
||||
$comment->setCreatedBy(new NullAccount($request->getHeader()->getAccount()));
|
||||
$comment->createdBy = new NullAccount($request->header->account);
|
||||
|
||||
return $comment;
|
||||
}
|
||||
|
|
@ -210,13 +210,13 @@ final class ApiController extends Controller
|
|||
{
|
||||
if (!empty($val = $this->validateKanbanBoardCreate($request))) {
|
||||
$response->set('kanban_board_create', new FormValidation($val));
|
||||
$response->getHeader()->setStatusCode(RequestStatusCode::R_400);
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$board = $this->createKanbanBoardFromRequest($request);
|
||||
$this->createModel($request->getHeader()->getAccount(), $board, KanbanBoardMapper::class, 'board',$request->getOrigin());
|
||||
$this->createModel($request->header->account, $board, KanbanBoardMapper::class, 'board',$request->getOrigin());
|
||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Board', 'Board successfully created.', $board);
|
||||
}
|
||||
|
||||
|
|
@ -232,11 +232,11 @@ final class ApiController extends Controller
|
|||
public function createKanbanBoardFromRequest(RequestAbstract $request) : KanbanBoard
|
||||
{
|
||||
$board = new KanbanBoard();
|
||||
$board->setName((string) $request->getData('title'));
|
||||
$board->setDescription((string) ($request->getData('plain') ?? ''));
|
||||
$board->name = (string) $request->getData('title');
|
||||
$board->description = (string) ($request->getData('plain') ?? '');
|
||||
$board->setOrder((int) ($request->getData('order') ?? 1));
|
||||
$board->setStatus((int) ($request->getData('status') ?? BoardStatus::ACTIVE));
|
||||
$board->setCreatedBy(new NullAccount($request->getHeader()->getAccount()));
|
||||
$board->createdBy = new NullAccount($request->header->account);
|
||||
|
||||
return $board;
|
||||
}
|
||||
|
|
@ -282,13 +282,13 @@ final class ApiController extends Controller
|
|||
{
|
||||
if (!empty($val = $this->validateKanbanColumnCreate($request))) {
|
||||
$response->set('kanban_column_create', new FormValidation($val));
|
||||
$response->getHeader()->setStatusCode(RequestStatusCode::R_400);
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$column = $this->createKanbanColumnFromRequest($request);
|
||||
$this->createModel($request->getHeader()->getAccount(), $column, KanbanColumnMapper::class, 'column', $request->getOrigin());
|
||||
$this->createModel($request->header->account, $column, KanbanColumnMapper::class, 'column', $request->getOrigin());
|
||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Column', 'Column successfully created.', $column);
|
||||
}
|
||||
|
||||
|
|
@ -304,7 +304,7 @@ final class ApiController extends Controller
|
|||
public function createKanbanColumnFromRequest(RequestAbstract $request) : KanbanColumn
|
||||
{
|
||||
$column = new KanbanColumn();
|
||||
$column->setName((string) $request->getData('title'));
|
||||
$column->name = (string) $request->getData('title');
|
||||
$column->setBoard((int) $request->getData('board'));
|
||||
$column->setOrder((int) ($request->getData('order') ?? 1));
|
||||
|
||||
|
|
|
|||
|
|
@ -103,14 +103,14 @@ final class BackendController extends Controller
|
|||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$board = KanbanBoardMapper::get((int) $request->getData('id'));
|
||||
$accountId = $request->getHeader()->getAccount();
|
||||
$accountId = $request->header->account;
|
||||
|
||||
if ($board->getCreatedBy()->getId() !== $accountId
|
||||
if ($board->createdBy->getId() !== $accountId
|
||||
&& !$this->app->accountManager->get($accountId)->hasPermission(
|
||||
PermissionType::READ, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::BOARD, $board->getId())
|
||||
) {
|
||||
$view->setTemplate('/Web/Backend/Error/403_inline');
|
||||
$response->getHeader()->setStatusCode(RequestStatusCode::R_403);
|
||||
$response->header->status = RequestStatusCode::R_403;
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
@ -158,13 +158,13 @@ final class BackendController extends Controller
|
|||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$accountId = $request->getHeader()->getAccount();
|
||||
$accountId = $request->header->account;
|
||||
|
||||
if (!$this->app->accountManager->get($accountId)->hasPermission(
|
||||
PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::BOARD)
|
||||
) {
|
||||
$view->setTemplate('/Web/Backend/Error/403_inline');
|
||||
$response->getHeader()->setStatusCode(RequestStatusCode::R_403);
|
||||
$response->header->status = RequestStatusCode::R_403;
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
@ -191,14 +191,14 @@ final class BackendController extends Controller
|
|||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$card = KanbanCardMapper::get((int) $request->getData('id'));
|
||||
$accountId = $request->getHeader()->getAccount();
|
||||
$accountId = $request->header->account;
|
||||
|
||||
if ($card->getCreatedBy()->getId() !== $accountId
|
||||
if ($card->createdBy->getId() !== $accountId
|
||||
&& !$this->app->accountManager->get($accountId)->hasPermission(
|
||||
PermissionType::READ, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::CARD, $card->getId())
|
||||
) {
|
||||
$view->setTemplate('/Web/Backend/Error/403_inline');
|
||||
$response->getHeader()->setStatusCode(RequestStatusCode::R_403);
|
||||
$response->header->status = RequestStatusCode::R_403;
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class KanbanBoard implements \JsonSerializable
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private string $name = '';
|
||||
public string $name = '';
|
||||
|
||||
private int $status = BoardStatus::ACTIVE;
|
||||
|
||||
|
|
@ -53,11 +53,11 @@ class KanbanBoard implements \JsonSerializable
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private string $description = '';
|
||||
public string $description = '';
|
||||
|
||||
private Account $createdBy;
|
||||
public Account $createdBy;
|
||||
|
||||
private \DateTimeImmutable $createdAt;
|
||||
public \DateTimeImmutable $createdAt;
|
||||
|
||||
private array $columns = [];
|
||||
|
||||
|
|
@ -84,32 +84,6 @@ class KanbanBoard implements \JsonSerializable
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getName() : string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name Name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setName(string $name) : void
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status
|
||||
*
|
||||
|
|
@ -162,70 +136,6 @@ class KanbanBoard implements \JsonSerializable
|
|||
$this->order = $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDescription() : string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description Description
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDescription(string $description) : void
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get created by
|
||||
*
|
||||
* @return Account
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCreatedBy() : Account
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set created by
|
||||
*
|
||||
* @param Account $account Created by
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setCreatedBy(Account $account) : void
|
||||
{
|
||||
$this->createdBy = $account;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get created at date time
|
||||
*
|
||||
* @return \DateTimeImmutable
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCreatedAt() : \DateTimeImmutable
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the columns
|
||||
*
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class KanbanCard implements \JsonSerializable
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private string $name = '';
|
||||
public string $name = '';
|
||||
|
||||
private int $status = CardStatus::ACTIVE;
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ class KanbanCard implements \JsonSerializable
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private string $description = '';
|
||||
public string $description = '';
|
||||
|
||||
private $column = 0;
|
||||
|
||||
|
|
@ -62,9 +62,9 @@ class KanbanCard implements \JsonSerializable
|
|||
|
||||
private $ref = 0;
|
||||
|
||||
private Account $createdBy;
|
||||
public Account $createdBy;
|
||||
|
||||
private \DateTimeImmutable $createdAt;
|
||||
public \DateTimeImmutable $createdAt;
|
||||
|
||||
private array $comments = [];
|
||||
|
||||
|
|
@ -147,32 +147,6 @@ class KanbanCard implements \JsonSerializable
|
|||
return $this->column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getName() : string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name Name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setName(string $name) : void
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status
|
||||
*
|
||||
|
|
@ -251,70 +225,6 @@ class KanbanCard implements \JsonSerializable
|
|||
$this->ref = $ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDescription() : string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description Description
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDescription(string $description) : void
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get created by
|
||||
*
|
||||
* @return Account
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCreatedBy() : Account
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set created by
|
||||
*
|
||||
* @param Account $account Created by
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setCreatedBy(Account $account) : void
|
||||
{
|
||||
$this->createdBy = $account;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get created at date time
|
||||
*
|
||||
* @return \DateTimeImmutable
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCreatedAt() : \DateTimeImmutable
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the comments
|
||||
*
|
||||
|
|
|
|||
|
|
@ -41,13 +41,13 @@ class KanbanCardComment implements \JsonSerializable
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private string $description = '';
|
||||
public string $description = '';
|
||||
|
||||
private $card = 0;
|
||||
|
||||
private Account $createdBy;
|
||||
public Account $createdBy;
|
||||
|
||||
private \DateTimeImmutable $createdAt;
|
||||
public \DateTimeImmutable $createdAt;
|
||||
|
||||
private array $media = [];
|
||||
|
||||
|
|
@ -100,70 +100,6 @@ class KanbanCardComment implements \JsonSerializable
|
|||
return $this->card;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDescription() : string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description Description
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDescription(string $description) : void
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get created by
|
||||
*
|
||||
* @return Account
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCreatedBy() : Account
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set created by
|
||||
*
|
||||
* @param Account $account Created by
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setCreatedBy(Account $account) : void
|
||||
{
|
||||
$this->createdBy = $account;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get created at date time
|
||||
*
|
||||
* @return \DateTimeImmutable
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCreatedAt() : \DateTimeImmutable
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the media files
|
||||
*
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class KanbanColumn implements \JsonSerializable
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private string $name = '';
|
||||
public string $name = '';
|
||||
|
||||
/**
|
||||
* Column order
|
||||
|
|
@ -122,32 +122,6 @@ class KanbanColumn implements \JsonSerializable
|
|||
return $this->board;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getName() : string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name Name
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setName(string $name) : void
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cards
|
||||
*
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ $columns = $board->getColumns();
|
|||
<div class="row">
|
||||
<?php $i = 0; foreach ($columns as $column) : $i++; $cards = $column->getCards(); ?>
|
||||
<div id="kanban-column-<?= $this->printHtml($i); ?>" class="col-xs-12 col-sm-3" draggable="true">
|
||||
<header><?= $this->printHtml($column->getName()); ?></header>
|
||||
<header><?= $this->printHtml($column->name); ?></header>
|
||||
<?php $j = 0; foreach ($cards as $card) : $j++; $labels = $card->getLabels(); ?>
|
||||
<a href="<?= $this->printHtml(\phpOMS\Uri\UriFactory::build('{/prefix}kanban/card?{?}&id=' . $card->getId())); ?>">
|
||||
<section id="kanban-card-<?= $this->printHtml($i . '-' . $j); ?>" class="box wf-100" draggable="true">
|
||||
<header><h1><?= $this->printHtml($card->getName()); ?></h1></header>
|
||||
<header><h1><?= $this->printHtml($card->name); ?></h1></header>
|
||||
<div class="inner">
|
||||
<?= $this->printHtml($card->getDescription()); ?>
|
||||
<?= $this->printHtml($card->description); ?>
|
||||
<?php foreach ($labels as $label) : ?>
|
||||
<span class="tag" style="background: #<?= $this->printHtml(\dechex($label->getColor())); ?>"><?= $this->printHtml($label->getName()); ?></span>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ $comments = $card->getComments();
|
|||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="box wf-100">
|
||||
<header><h1><?= $this->printHtml($card->getName()); ?></h1></header>
|
||||
<header><h1><?= $this->printHtml($card->name); ?></h1></header>
|
||||
<div class="inner">
|
||||
<?= $this->printHtml($card->getDescription()); ?>
|
||||
<?= $this->printHtml($card->description); ?>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
|
@ -19,7 +19,7 @@ $comments = $card->getComments();
|
|||
<div class="col-xs-12">
|
||||
<section class="box wf-100">
|
||||
<div class="inner">
|
||||
<?= $this->printHtml($comment->getDescription()); ?>
|
||||
<?= $this->printHtml($comment->description); ?>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ echo $this->getData('nav')->render(); ?>
|
|||
<div class="col-xs-12 col-sm-6 col-lg-3">
|
||||
<a href="<?= $this->printHtml(UriFactory::build('{/prefix}kanban/board?{?}&id=' . $board->getId())); ?>">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->printHtml($board->getName()); ?></div>
|
||||
<div class="portlet-head"><?= $this->printHtml($board->name); ?></div>
|
||||
<div class="portlet-body">
|
||||
<?= $this->printHtml($board->getDescription()); ?>
|
||||
<?= $this->printHtml($board->description); ?>
|
||||
</div>
|
||||
</section>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -87,13 +87,13 @@ class ControllerTest extends \PHPUnit\Framework\TestCase
|
|||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->getHeader()->setAccount(1);
|
||||
$request->header->account = 1;
|
||||
$request->setData('title', 'Controller Test Board');
|
||||
$request->setData('plain', 'Controller Test Description');
|
||||
|
||||
$this->module->apiKanbanBoardCreate($request, $response);
|
||||
|
||||
self::assertEquals('Controller Test Board', $response->get('')['response']->getName());
|
||||
self::assertEquals('Controller Test Board', $response->get('')['response']->name);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
||||
}
|
||||
|
||||
|
|
@ -106,13 +106,13 @@ class ControllerTest extends \PHPUnit\Framework\TestCase
|
|||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->getHeader()->setAccount(1);
|
||||
$request->header->account = 1;
|
||||
$request->setData('title', 'Controller Test Column');
|
||||
$request->setData('board', 1);
|
||||
|
||||
$this->module->apiKanbanColumnCreate($request, $response);
|
||||
|
||||
self::assertEquals('Controller Test Column', $response->get('')['response']->getName());
|
||||
self::assertEquals('Controller Test Column', $response->get('')['response']->name);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
||||
}
|
||||
|
||||
|
|
@ -125,14 +125,14 @@ class ControllerTest extends \PHPUnit\Framework\TestCase
|
|||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->getHeader()->setAccount(1);
|
||||
$request->header->account = 1;
|
||||
$request->setData('title', 'Controller Test Card');
|
||||
$request->setData('plain', 'Controller Test Description');
|
||||
$request->setData('column', '1');
|
||||
|
||||
$this->module->apiKanbanCardCreate($request, $response);
|
||||
|
||||
self::assertEquals('Controller Test Card', $response->get('')['response']->getName());
|
||||
self::assertEquals('Controller Test Card', $response->get('')['response']->name);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,20 +32,20 @@ class KanbanBoardMapperTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
$board = new KanbanBoard();
|
||||
|
||||
$board->setName('Test Board 0');
|
||||
$board->setDescription('This is some description');
|
||||
$board->setCreatedBy(new NullAccount(1));
|
||||
$board->name = 'Test Board 0';
|
||||
$board->description = 'This is some description';
|
||||
$board->createdBy = new NullAccount(1);
|
||||
|
||||
$id = KanbanBoardMapper::create($board);
|
||||
self::assertGreaterThan(0, $board->getId());
|
||||
self::assertEquals($id, $board->getId());
|
||||
|
||||
$boardR = KanbanBoardMapper::get($board->getId());
|
||||
self::assertEquals($board->getName(), $boardR->getName());
|
||||
self::assertEquals($board->name, $boardR->name);
|
||||
self::assertEquals($board->getStatus(), $boardR->getStatus());
|
||||
self::assertEquals($board->getDescription(), $boardR->getDescription());
|
||||
self::assertEquals($board->getCreatedBy()->getId(), $boardR->getCreatedBy()->getId());
|
||||
self::assertEquals($board->getCreatedAt()->format('Y-m-d'), $boardR->getCreatedAt()->format('Y-m-d'));
|
||||
self::assertEquals($board->description, $boardR->description);
|
||||
self::assertEquals($board->createdBy->getId(), $boardR->createdBy->getId());
|
||||
self::assertEquals($board->createdAt->format('Y-m-d'), $boardR->createdAt->format('Y-m-d'));
|
||||
self::assertEquals($board->getColumns(), $boardR->getColumns());
|
||||
}
|
||||
|
||||
|
|
@ -60,9 +60,9 @@ class KanbanBoardMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$text = new Text();
|
||||
$board = new KanbanBoard();
|
||||
|
||||
$board->setName($text->generateText(\mt_rand(3, 7)));
|
||||
$board->setDescription($text->generateText(\mt_rand(20, 70)));
|
||||
$board->setCreatedBy(new NullAccount(1));
|
||||
$board->name = $text->generateText(\mt_rand(3, 7));
|
||||
$board->description = $text->generateText(\mt_rand(20, 70));
|
||||
$board->createdBy = new NullAccount(1);
|
||||
|
||||
$id = KanbanBoardMapper::create($board);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class KanbanColumnMapperTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
$column = new KanbanColumn();
|
||||
|
||||
$column->setName('Some Column');
|
||||
$column->name = 'Some Column';
|
||||
$column->setBoard(1);
|
||||
$column->setOrder(1);
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ class KanbanColumnMapperTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($id, $column->getId());
|
||||
|
||||
$columnR = KanbanColumnMapper::get($column->getId());
|
||||
self::assertEquals($column->getName(), $columnR->getName());
|
||||
self::assertEquals($column->name, $columnR->name);
|
||||
self::assertEquals($column->getBoard(), $columnR->getBoard());
|
||||
self::assertEquals($column->getOrder(), $columnR->getOrder());
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ class KanbanColumnMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$text = new Text();
|
||||
$column = new KanbanColumn();
|
||||
|
||||
$column->setName($text->generateText(\mt_rand(3, 7)));
|
||||
$column->name = $text->generateText(\mt_rand(3, 7));
|
||||
$column->setBoard(1);
|
||||
$column->setOrder($i + 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ class KanbanCardMapperTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
$card = new KanbanCard();
|
||||
|
||||
$card->setName('Some Card name');
|
||||
$card->setDescription('This is some card description');
|
||||
$card->name = 'Some Card name';
|
||||
$card->description = 'This is some card description';
|
||||
$card->setStatus(CardStatus::ACTIVE);
|
||||
$card->setType(CardType::TEXT);
|
||||
$card->setOrder(1);
|
||||
$card->setColumn(1);
|
||||
$card->setCreatedBy(new NullAccount(1));
|
||||
$card->createdBy = new NullAccount(1);
|
||||
$card->addLabel(1);
|
||||
$card->addLabel(2);
|
||||
|
||||
|
|
@ -49,14 +49,14 @@ class KanbanCardMapperTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($id, $card->getId());
|
||||
|
||||
$cardR = KanbanCardMapper::get($card->getId());
|
||||
self::assertEquals($card->getName(), $cardR->getName());
|
||||
self::assertEquals($card->getDescription(), $cardR->getDescription());
|
||||
self::assertEquals($card->name, $cardR->name);
|
||||
self::assertEquals($card->description, $cardR->description);
|
||||
self::assertEquals($card->getColumn(), $cardR->getColumn());
|
||||
self::assertEquals($card->getOrder(), $cardR->getOrder());
|
||||
self::assertEquals($card->getStatus(), $cardR->getStatus());
|
||||
self::assertEquals($card->getType(), $cardR->getType());
|
||||
self::assertEquals($card->getCreatedBy()->getId(), $cardR->getCreatedBy()->getId());
|
||||
self::assertEquals($card->getCreatedAt()->format('Y-m-d'), $cardR->getCreatedAt()->format('Y-m-d'));
|
||||
self::assertEquals($card->createdBy->getId(), $cardR->createdBy->getId());
|
||||
self::assertEquals($card->createdAt->format('Y-m-d'), $cardR->createdAt->format('Y-m-d'));
|
||||
self::assertEquals($card->getRef(), $cardR->getRef());
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ class KanbanCardMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$card->setRef(1);
|
||||
$card->setOrder(1);
|
||||
$card->setColumn(1);
|
||||
$card->setCreatedBy(new NullAccount(1));
|
||||
$card->createdBy = new NullAccount(1);
|
||||
$card->addLabel(1);
|
||||
$card->addLabel(2);
|
||||
|
||||
|
|
@ -93,13 +93,13 @@ class KanbanCardMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$text = new Text();
|
||||
$card = new KanbanCard();
|
||||
|
||||
$card->setName($text->generateText(\mt_rand(3, 7)));
|
||||
$card->setDescription($text->generateText(\mt_rand(20, 100)));
|
||||
$card->name = $text->generateText(\mt_rand(3, 7));
|
||||
$card->description = $text->generateText(\mt_rand(20, 100));
|
||||
$card->setStatus(CardStatus::ACTIVE);
|
||||
$card->setType(CardType::TEXT);
|
||||
$card->setOrder(\mt_rand(1, 10));
|
||||
$card->setColumn(\mt_rand(1, 4));
|
||||
$card->setCreatedBy(new NullAccount(1));
|
||||
$card->createdBy = new NullAccount(1);
|
||||
$card->addLabel(2);
|
||||
$card->addLabel(3);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,19 +32,19 @@ class KanbanCardCommentMapperTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
$comment = new KanbanCardComment();
|
||||
|
||||
$comment->setDescription('This is some card description');
|
||||
$comment->description = 'This is some card description';
|
||||
$comment->setCard(1);
|
||||
$comment->setCreatedBy(new NullAccount(1));
|
||||
$comment->createdBy = new NullAccount(1);
|
||||
|
||||
$id = KanbanCardCommentMapper::create($comment);
|
||||
self::assertGreaterThan(0, $comment->getId());
|
||||
self::assertEquals($id, $comment->getId());
|
||||
|
||||
$commentR = KanbanCardCommentMapper::get($comment->getId());
|
||||
self::assertEquals($comment->getDescription(), $commentR->getDescription());
|
||||
self::assertEquals($comment->description, $commentR->description);
|
||||
self::assertEquals($comment->getCard(), $commentR->getCard());
|
||||
self::assertEquals($comment->getCreatedBy()->getId(), $commentR->getCreatedBy()->getId());
|
||||
self::assertEquals($comment->getCreatedAt()->format('Y-m-d'), $commentR->getCreatedAt()->format('Y-m-d'));
|
||||
self::assertEquals($comment->createdBy->getId(), $commentR->createdBy->getId());
|
||||
self::assertEquals($comment->createdAt->format('Y-m-d'), $commentR->createdAt->format('Y-m-d'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -58,9 +58,9 @@ class KanbanCardCommentMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$text = new Text();
|
||||
$comment = new KanbanCardComment();
|
||||
|
||||
$comment->setDescription($text->generateText(\mt_rand(20, 100)));
|
||||
$comment->description = $text->generateText(\mt_rand(20, 100));
|
||||
$comment->setCard(1);
|
||||
$comment->setCreatedBy(new NullAccount(1));
|
||||
$comment->createdBy = new NullAccount(1);
|
||||
|
||||
$id = KanbanCardCommentMapper::create($comment);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ class KanbanBoardTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
self::assertEquals(0, $board->getId());
|
||||
self::assertEquals(BoardStatus::ACTIVE, $board->getStatus());
|
||||
self::assertEquals('', $board->getName());
|
||||
self::assertEquals('', $board->getDescription());
|
||||
self::assertEquals(0, $board->getCreatedBy()->getId());
|
||||
self::assertInstanceOf('\DateTimeImmutable', $board->getCreatedAt());
|
||||
self::assertEquals('', $board->name);
|
||||
self::assertEquals('', $board->description);
|
||||
self::assertEquals(0, $board->createdBy->getId());
|
||||
self::assertInstanceOf('\DateTimeImmutable', $board->createdAt);
|
||||
self::assertEquals([], $board->getColumns());
|
||||
}
|
||||
|
||||
|
|
@ -48,16 +48,16 @@ class KanbanBoardTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
$board = new KanbanBoard();
|
||||
|
||||
$board->setName('Name');
|
||||
$board->setDescription('Description');
|
||||
$board->name = 'Name';
|
||||
$board->description = 'Description';
|
||||
$board->setStatus(BoardStatus::ARCHIVED);
|
||||
$board->setCreatedBy(new NullAccount(1));
|
||||
$board->createdBy = new NullAccount(1);
|
||||
$board->addColumn(2);
|
||||
|
||||
self::assertEquals(BoardStatus::ARCHIVED, $board->getStatus());
|
||||
self::assertEquals('Name', $board->getName());
|
||||
self::assertEquals('Description', $board->getDescription());
|
||||
self::assertEquals(1, $board->getCreatedBy()->getId());
|
||||
self::assertEquals('Name', $board->name);
|
||||
self::assertEquals('Description', $board->description);
|
||||
self::assertEquals(1, $board->createdBy->getId());
|
||||
self::assertEquals([2], $board->getColumns());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ class KanbanCardCommentTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
self::assertEquals(0, $comment->getId());
|
||||
self::assertEquals(0, $comment->getCard());
|
||||
self::assertEquals('', $comment->getDescription());
|
||||
self::assertEquals(0, $comment->getCreatedBy()->getId());
|
||||
self::assertInstanceOf('\DateTimeImmutable', $comment->getCreatedAt());
|
||||
self::assertEquals('', $comment->description);
|
||||
self::assertEquals(0, $comment->createdBy->getId());
|
||||
self::assertInstanceOf('\DateTimeImmutable', $comment->createdAt);
|
||||
self::assertEquals([], $comment->getMedia());
|
||||
}
|
||||
|
||||
|
|
@ -47,13 +47,13 @@ class KanbanCardCommentTest extends \PHPUnit\Framework\TestCase
|
|||
$comment = new KanbanCardComment();
|
||||
|
||||
$comment->setCard(2);
|
||||
$comment->setDescription('Description');
|
||||
$comment->setCreatedBy(new NullAccount(1));
|
||||
$comment->description = 'Description';
|
||||
$comment->createdBy = new NullAccount(1);
|
||||
$comment->addMedia(3);
|
||||
|
||||
self::assertEquals(2, $comment->getCard());
|
||||
self::assertEquals('Description', $comment->getDescription());
|
||||
self::assertEquals(1, $comment->getCreatedBy()->getId());
|
||||
self::assertEquals('Description', $comment->description);
|
||||
self::assertEquals(1, $comment->createdBy->getId());
|
||||
self::assertEquals([3], $comment->getMedia());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,12 +35,12 @@ class KanbanCardTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(0, $card->getId());
|
||||
self::assertEquals(CardStatus::ACTIVE, $card->getStatus());
|
||||
self::assertEquals(CardType::TEXT, $card->getType());
|
||||
self::assertEquals('', $card->getName());
|
||||
self::assertEquals('', $card->getDescription());
|
||||
self::assertEquals('', $card->name);
|
||||
self::assertEquals('', $card->description);
|
||||
self::assertEquals(0, $card->getColumn());
|
||||
self::assertEquals(0, $card->getOrder());
|
||||
self::assertEquals(0, $card->getCreatedBy()->getId());
|
||||
self::assertInstanceOf('\DateTimeImmutable', $card->getCreatedAt());
|
||||
self::assertEquals(0, $card->createdBy->getId());
|
||||
self::assertInstanceOf('\DateTimeImmutable', $card->createdAt);
|
||||
self::assertEquals([], $card->getComments());
|
||||
self::assertEquals([], $card->getLabels());
|
||||
self::assertEquals([], $card->getMedia());
|
||||
|
|
@ -55,21 +55,21 @@ class KanbanCardTest extends \PHPUnit\Framework\TestCase
|
|||
$card = new KanbanCard();
|
||||
$card->setStatus(CardStatus::ARCHIVED);
|
||||
$card->setType(CardType::TASK);
|
||||
$card->setName('Name');
|
||||
$card->setDescription('Description');
|
||||
$card->name = 'Name';
|
||||
$card->description = 'Description';
|
||||
$card->setColumn(1);
|
||||
$card->setOrder(2);
|
||||
$card->setCreatedBy(new NullAccount(1));
|
||||
$card->createdBy = new NullAccount(1);
|
||||
$card->addComment(5);
|
||||
$card->addMedia(7);
|
||||
|
||||
self::assertEquals(CardStatus::ARCHIVED, $card->getStatus());
|
||||
self::assertEquals(CardType::TASK, $card->getType());
|
||||
self::assertEquals('Name', $card->getName());
|
||||
self::assertEquals('Description', $card->getDescription());
|
||||
self::assertEquals('Name', $card->name);
|
||||
self::assertEquals('Description', $card->description);
|
||||
self::assertEquals(1, $card->getColumn());
|
||||
self::assertEquals(2, $card->getOrder());
|
||||
self::assertEquals(1, $card->getCreatedBy()->getId());
|
||||
self::assertEquals(1, $card->createdBy->getId());
|
||||
self::assertEquals([5], $card->getComments());
|
||||
self::assertEquals([7], $card->getMedia());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class KanbanColumnTest extends \PHPUnit\Framework\TestCase
|
|||
$column = new KanbanColumn();
|
||||
|
||||
self::assertEquals(0, $column->getId());
|
||||
self::assertEquals('', $column->getName());
|
||||
self::assertEquals('', $column->name);
|
||||
self::assertEquals(0, $column->getOrder());
|
||||
self::assertEquals(0, $column->getBoard());
|
||||
self::assertEquals([], $column->getCards());
|
||||
|
|
@ -45,12 +45,12 @@ class KanbanColumnTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
$column = new KanbanColumn();
|
||||
|
||||
$column->setName('Name');
|
||||
$column->name = 'Name';
|
||||
$column->setOrder(2);
|
||||
$column->setBoard(3);
|
||||
$column->addCard(new KanbanCard());
|
||||
|
||||
self::assertEquals('Name', $column->getName());
|
||||
self::assertEquals('Name', $column->name);
|
||||
self::assertEquals(2, $column->getOrder());
|
||||
self::assertEquals(3, $column->getBoard());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user