diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cab9f5e..ad8944e 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,9 +12,7 @@ If you have a good idea for improvement feel free to create a new issue with all ### Issues -Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the `Project.md` file in the `Docs` repository. - -The issue information can be used to provide additional information such as priority, difficulty and type. For your first issue try to find a issue marked `[d:first]` or `[d:beginner]`. +Feel free to grab any open issue implement it and create a new pull request. Most issues can be found in the code marked with `@todo` or in the [PROJECT.md](https://github.com/Orange-Management/Docs/blob/master/Project/PROJECT.md) file. ### Code Style diff --git a/Controller/ApiController.php b/Controller/ApiController.php index a0cb024..57b5a69 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -89,9 +89,9 @@ final class ApiController extends Controller $card->descriptionRaw = (string) ($request->getData('plain') ?? ''); $card->description = Markdown::parse((string) ($request->getData('plain') ?? '')); $card->style = (string) ($request->getData('style') ?? ''); - $card->column = (int) $request->getData('column'); - $card->order = (int) ($request->getData('order') ?? 1); - $card->ref = (int) ($request->getData('ref') ?? 0); + $card->column = (int) $request->getData('column'); + $card->order = (int) ($request->getData('order') ?? 1); + $card->ref = (int) ($request->getData('ref') ?? 0); $card->setStatus((int) ($request->getData('status') ?? CardStatus::ACTIVE)); $card->setType((int) ($request->getData('type') ?? CardType::TEXT)); $card->createdBy = new NullAccount($request->header->account); @@ -207,8 +207,8 @@ final class ApiController extends Controller $comment = new KanbanCardComment(); $comment->description = Markdown::parse((string) ($request->getData('plain') ?? '')); $comment->descriptionRaw = (string) ($request->getData('plain') ?? ''); - $comment->card = (int) $request->getData('card'); - $comment->createdBy = new NullAccount($request->header->account); + $comment->card = (int) $request->getData('card'); + $comment->createdBy = new NullAccount($request->header->account); if (!empty($uploadedFiles = $request->getFiles() ?? [])) { $uploaded = $this->app->moduleManager->get('Media')->uploadFiles( @@ -421,8 +421,8 @@ final class ApiController extends Controller */ public function createKanbanColumnFromRequest(RequestAbstract $request) : KanbanColumn { - $column = new KanbanColumn(); - $column->name = (string) $request->getData('title'); + $column = new KanbanColumn(); + $column->name = (string) $request->getData('title'); $column->board = (int) $request->getData('board'); $column->order = (int) ($request->getData('order') ?? 1); diff --git a/Models/KanbanBoard.php b/Models/KanbanBoard.php index 0363fd3..4c4fd2b 100755 --- a/Models/KanbanBoard.php +++ b/Models/KanbanBoard.php @@ -16,8 +16,8 @@ namespace Modules\Kanban\Models; use Modules\Admin\Models\Account; use Modules\Admin\Models\NullAccount; -use Modules\Tag\Models\Tag; use Modules\Tag\Models\NullTag; +use Modules\Tag\Models\Tag; /** * Kanban board class. @@ -258,10 +258,10 @@ class KanbanBoard implements \JsonSerializable public function toArray() : array { return [ - 'id' => $this->id, - 'status' => $this->status, + 'id' => $this->id, + 'status' => $this->status, 'columns' => $this->columns, - 'tags' => $this->tags, + 'tags' => $this->tags, ]; } diff --git a/Models/KanbanCard.php b/Models/KanbanCard.php index d81beed..d917885 100755 --- a/Models/KanbanCard.php +++ b/Models/KanbanCard.php @@ -17,8 +17,8 @@ namespace Modules\Kanban\Models; use Modules\Admin\Models\Account; use Modules\Admin\Models\NullAccount; use Modules\Media\Models\Media; -use Modules\Tag\Models\Tag; use Modules\Tag\Models\NullTag; +use Modules\Tag\Models\Tag; use Modules\Tasks\Models\Task; /** @@ -364,19 +364,19 @@ class KanbanCard implements \JsonSerializable public function toArray() : array { return [ - 'id' => $this->id, - 'title' => $this->name, - 'description' => $this->description, + 'id' => $this->id, + 'title' => $this->name, + 'description' => $this->description, 'descriptionRaw' => $this->descriptionRaw, - 'status' => $this->status, - 'type' => $this->type, - 'column' => $this->column, - 'order' => $this->order, - 'ref' => $this->ref, - 'createdBy' => $this->createdBy, - 'createdAt' => $this->createdAt, - 'comments' => $this->comments, - 'media' => $this->media, + 'status' => $this->status, + 'type' => $this->type, + 'column' => $this->column, + 'order' => $this->order, + 'ref' => $this->ref, + 'createdBy' => $this->createdBy, + 'createdAt' => $this->createdAt, + 'comments' => $this->comments, + 'media' => $this->media, ]; } diff --git a/Models/KanbanCardComment.php b/Models/KanbanCardComment.php index 4a20b5e..721efb8 100755 --- a/Models/KanbanCardComment.php +++ b/Models/KanbanCardComment.php @@ -138,13 +138,13 @@ class KanbanCardComment implements \JsonSerializable public function toArray() : array { return [ - 'id' => $this->id, - 'description' => $this->description, + 'id' => $this->id, + 'description' => $this->description, 'descriptionRaw' => $this->descriptionRaw, - 'card' => $this->card, - 'createdBy' => $this->createdBy, - 'createdAt' => $this->createdAt, - 'media' => $this->media, + 'card' => $this->card, + 'createdBy' => $this->createdBy, + 'createdAt' => $this->createdAt, + 'media' => $this->media, ]; } diff --git a/Models/KanbanColumn.php b/Models/KanbanColumn.php index baa7749..23cba00 100755 --- a/Models/KanbanColumn.php +++ b/Models/KanbanColumn.php @@ -128,11 +128,11 @@ class KanbanColumn implements \JsonSerializable public function toArray() : array { return [ - 'id' => $this->id, - 'name' => $this->name, - 'order' => $this->order, + 'id' => $this->id, + 'name' => $this->name, + 'order' => $this->order, 'board' => $this->board, - 'cards' => $this->cards, + 'cards' => $this->cards, ]; } diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 3f83bdd..a7f63a3 100644 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -24,13 +24,13 @@ use phpOMS\Dispatcher\Dispatcher; use phpOMS\Event\EventManager; use phpOMS\Message\Http\HttpRequest; use phpOMS\Message\Http\HttpResponse; +use phpOMS\Message\Http\RequestStatusCode; +use phpOMS\Module\ModuleAbstract; use phpOMS\Module\ModuleManager; use phpOMS\Router\WebRouter; +use phpOMS\System\MimeType; use phpOMS\Uri\HttpUri; use phpOMS\Utils\TestUtils; -use phpOMS\Module\ModuleAbstract; -use phpOMS\System\MimeType; -use phpOMS\Message\Http\RequestStatusCode; /** * @internal diff --git a/tests/Models/1KanbanBoardMapperTest.php b/tests/Models/KanbanBoardMapperTest.php old mode 100755 new mode 100644 similarity index 98% rename from tests/Models/1KanbanBoardMapperTest.php rename to tests/Models/KanbanBoardMapperTest.php index 0162e9f..22c6b5d --- a/tests/Models/1KanbanBoardMapperTest.php +++ b/tests/Models/KanbanBoardMapperTest.php @@ -17,7 +17,6 @@ namespace Modules\Kanban\tests\Models; use Modules\Admin\Models\NullAccount; use Modules\Kanban\Models\KanbanBoard; use Modules\Kanban\Models\KanbanBoardMapper; -use phpOMS\Utils\RnG\Text; /** * @internal diff --git a/tests/Models/KanbanBoardTest.php b/tests/Models/KanbanBoardTest.php index 053532c..2c19f5b 100755 --- a/tests/Models/KanbanBoardTest.php +++ b/tests/Models/KanbanBoardTest.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Modules\Kanban\tests\Models; -use Modules\Admin\Models\NullAccount; use Modules\Kanban\Models\BoardStatus; use Modules\Kanban\Models\KanbanBoard; use Modules\Tag\Models\Tag; @@ -107,10 +106,10 @@ final class KanbanBoardTest extends \PHPUnit\Framework\TestCase self::assertEquals( [ - 'id' => 0, - 'status' => BoardStatus::ARCHIVED, + 'id' => 0, + 'status' => BoardStatus::ARCHIVED, 'columns' => [], - 'tags' => [], + 'tags' => [], ], $serialized ); diff --git a/tests/Models/5KanbanCardCommentMapperTest.php b/tests/Models/KanbanCardCommentMapperTest.php old mode 100755 new mode 100644 similarity index 89% rename from tests/Models/5KanbanCardCommentMapperTest.php rename to tests/Models/KanbanCardCommentMapperTest.php index 0ad6d4d..fa689c8 --- a/tests/Models/5KanbanCardCommentMapperTest.php +++ b/tests/Models/KanbanCardCommentMapperTest.php @@ -17,7 +17,6 @@ namespace Modules\Kanban\tests\Models; use Modules\Admin\Models\NullAccount; use Modules\Kanban\Models\KanbanCardComment; use Modules\Kanban\Models\KanbanCardCommentMapper; -use phpOMS\Utils\RnG\Text; /** * @internal @@ -25,6 +24,7 @@ use phpOMS\Utils\RnG\Text; final class KanbanCardCommentMapperTest extends \PHPUnit\Framework\TestCase { /** + * @depends Modules\Kanban\tests\Models\KanbanCardMapperTest::testCRUD * @covers Modules\Kanban\Models\KanbanCardCommentMapper * @group module */ @@ -33,8 +33,8 @@ final class KanbanCardCommentMapperTest extends \PHPUnit\Framework\TestCase $comment = new KanbanCardComment(); $comment->description = 'This is some card description'; - $comment->card = 1; - $comment->createdBy = new NullAccount(1); + $comment->card = 1; + $comment->createdBy = new NullAccount(1); $id = KanbanCardCommentMapper::create($comment); self::assertGreaterThan(0, $comment->getId()); diff --git a/tests/Models/KanbanCardCommentTest.php b/tests/Models/KanbanCardCommentTest.php index 2bb0443..4258ea5 100755 --- a/tests/Models/KanbanCardCommentTest.php +++ b/tests/Models/KanbanCardCommentTest.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Modules\Kanban\tests\Models; -use Modules\Admin\Models\NullAccount; use Modules\Kanban\Models\KanbanCardComment; use Modules\Media\Models\NullMedia; @@ -63,9 +62,9 @@ final class KanbanCardCommentTest extends \PHPUnit\Framework\TestCase */ public function testSerialize() : void { - $this->comment->description = 'Description'; + $this->comment->description = 'Description'; $this->comment->descriptionRaw = 'DescriptionRaw'; - $this->comment->card = 2; + $this->comment->card = 2; $serialized = $this->comment->jsonSerialize(); unset($serialized['createdBy']); @@ -73,11 +72,11 @@ final class KanbanCardCommentTest extends \PHPUnit\Framework\TestCase self::assertEquals( [ - 'id' => 0, - 'description' => 'Description', + 'id' => 0, + 'description' => 'Description', 'descriptionRaw' => 'DescriptionRaw', - 'card' => 2, - 'media' => [], + 'card' => 2, + 'media' => [], ], $serialized ); diff --git a/tests/Models/4KanbanCardMapperTest.php b/tests/Models/KanbanCardMapperTest.php old mode 100755 new mode 100644 similarity index 91% rename from tests/Models/4KanbanCardMapperTest.php rename to tests/Models/KanbanCardMapperTest.php index 572bcd5..d90621a --- a/tests/Models/4KanbanCardMapperTest.php +++ b/tests/Models/KanbanCardMapperTest.php @@ -19,9 +19,7 @@ use Modules\Kanban\Models\CardStatus; use Modules\Kanban\Models\CardType; use Modules\Kanban\Models\KanbanCard; use Modules\Kanban\Models\KanbanCardMapper; -use Modules\Tag\Models\NullTag; use Modules\Tag\Models\Tag; -use phpOMS\Utils\RnG\Text; /** * @internal @@ -29,6 +27,7 @@ use phpOMS\Utils\RnG\Text; final class KanbanCardMapperTest extends \PHPUnit\Framework\TestCase { /** + * @depends Modules\Kanban\tests\Models\KanbanCardMapperTest::testCRUD * @covers Modules\Kanban\Models\KanbanCardMapper * @group module */ @@ -40,8 +39,8 @@ final class KanbanCardMapperTest extends \PHPUnit\Framework\TestCase $card->description = 'This is some card description'; $card->setStatus(CardStatus::ACTIVE); $card->setType(CardType::TEXT); - $card->order = 1; - $card->column = 1; + $card->order = 1; + $card->column = 1; $card->createdBy = new NullAccount(1); $card->addTag(new Tag()); $card->addTag(new Tag()); @@ -72,9 +71,9 @@ final class KanbanCardMapperTest extends \PHPUnit\Framework\TestCase $card->setStatus(CardStatus::ACTIVE); $card->setType(CardType::TASK); - $card->ref = 1; - $card->order = 1; - $card->column = 1; + $card->ref = 1; + $card->order = 1; + $card->column = 1; $card->createdBy = new NullAccount(1); $card->addTag(new Tag()); $card->addTag(new Tag()); diff --git a/tests/Models/KanbanCardTest.php b/tests/Models/KanbanCardTest.php index fcf3afe..c4ed75a 100755 --- a/tests/Models/KanbanCardTest.php +++ b/tests/Models/KanbanCardTest.php @@ -14,13 +14,12 @@ declare(strict_types=1); namespace Modules\Kanban\tests\Models; -use Modules\Admin\Models\NullAccount; use Modules\Kanban\Models\CardStatus; use Modules\Kanban\Models\CardType; use Modules\Kanban\Models\KanbanCard; use Modules\Media\Models\NullMedia; -use Modules\Tasks\Models\Task; use Modules\Tag\Models\Tag; +use Modules\Tasks\Models\Task; /** * @internal @@ -150,11 +149,11 @@ final class KanbanCardTest extends \PHPUnit\Framework\TestCase */ public function testSerialize() : void { - $this->card->name = 'Title'; - $this->card->description = 'Description'; + $this->card->name = 'Title'; + $this->card->description = 'Description'; $this->card->descriptionRaw = 'DescriptionRaw'; - $this->card->order = 3; - $this->card->column = 2; + $this->card->order = 3; + $this->card->column = 2; $this->card->setStatus(CardStatus::ARCHIVED); $this->card->setType(CardType::TASK); @@ -164,17 +163,17 @@ final class KanbanCardTest extends \PHPUnit\Framework\TestCase self::assertEquals( [ - 'id' => 0, - 'title' => 'Title', - 'description' => 'Description', + 'id' => 0, + 'title' => 'Title', + 'description' => 'Description', 'descriptionRaw' => 'DescriptionRaw', - 'status' => CardStatus::ARCHIVED, - 'type' => CardType::TASK, - 'column' => 2, - 'order' => 3, - 'ref' => 0, - 'comments' => [], - 'media' => [], + 'status' => CardStatus::ARCHIVED, + 'type' => CardType::TASK, + 'column' => 2, + 'order' => 3, + 'ref' => 0, + 'comments' => [], + 'media' => [], ], $serialized ); diff --git a/tests/Models/3KanbanColumnMapperTest.php b/tests/Models/KanbanColumnMapperTest.php old mode 100755 new mode 100644 similarity index 90% rename from tests/Models/3KanbanColumnMapperTest.php rename to tests/Models/KanbanColumnMapperTest.php index c827f21..5660cef --- a/tests/Models/3KanbanColumnMapperTest.php +++ b/tests/Models/KanbanColumnMapperTest.php @@ -16,7 +16,6 @@ namespace Modules\Kanban\tests\Models; use Modules\Kanban\Models\KanbanColumn; use Modules\Kanban\Models\KanbanColumnMapper; -use phpOMS\Utils\RnG\Text; /** * @internal @@ -24,6 +23,7 @@ use phpOMS\Utils\RnG\Text; final class KanbanColumnMapperTest extends \PHPUnit\Framework\TestCase { /** + * @depends Modules\Kanban\tests\Models\KanbanBoardMapperTest::testCRUD * @covers Modules\Kanban\Models\KanbanColumnMapper * @group module */ @@ -31,7 +31,7 @@ final class KanbanColumnMapperTest extends \PHPUnit\Framework\TestCase { $column = new KanbanColumn(); - $column->name = 'Some Column'; + $column->name = 'Some Column'; $column->board = 1; $column->order = 1; diff --git a/tests/Models/KanbanColumnTest.php b/tests/Models/KanbanColumnTest.php index 572a19d..d76d67d 100755 --- a/tests/Models/KanbanColumnTest.php +++ b/tests/Models/KanbanColumnTest.php @@ -74,7 +74,7 @@ final class KanbanColumnTest extends \PHPUnit\Framework\TestCase */ public function testSerialize() : void { - $this->column->name = 'Name'; + $this->column->name = 'Name'; $this->column->board = 2; $this->column->order = 3; @@ -84,10 +84,10 @@ final class KanbanColumnTest extends \PHPUnit\Framework\TestCase self::assertEquals( [ - 'id' => 0, - 'name' => 'Name', - 'order' => 3, - 'board' => 2, + 'id' => 0, + 'name' => 'Name', + 'order' => 3, + 'board' => 2, 'cards' => [], ], $serialized