oms-Comments/tests/Models/CommentVoteMapperTest.php
Dennis Eichhorn 805956c7c3
Some checks failed
Image optimization / general_image_workflow (push) Has been cancelled
CI / general_module_workflow_php (push) Has been cancelled
CI / general_module_workflow_js (push) Has been cancelled
fix permissions
2025-04-02 14:15:04 +00:00

56 lines
1.5 KiB
PHP

<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package tests
* @copyright Dennis Eichhorn
* @license OMS License 2.2
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Comments\tests\Models;
use Modules\Admin\Models\NullAccount;
use Modules\Comments\Models\Comment;
use Modules\Comments\Models\CommentList;
use Modules\Comments\Models\CommentListMapper;
use Modules\Comments\Models\CommentMapper;
use Modules\Comments\Models\CommentVote;
use Modules\Comments\Models\CommentVoteMapper;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\Comments\Models\CommentVoteMapper::class)]
final class CommentVoteMapperTest extends \PHPUnit\Framework\TestCase
{
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCR() : void
{
$list = new CommentList();
$lId = CommentListMapper::create()->execute($list);
$comment = new Comment();
$comment->title = 'TestComment';
$comment->createdBy = new NullAccount(1);
$comment->list = $lId;
$cId = CommentMapper::create()->execute($comment);
$vote = new CommentVote();
$vote->comment = $cId;
$vote->score = 1;
$vote->createdBy = 1;
CommentVoteMapper::create()->execute($vote);
$voteR = CommentvoteMapper::findVote($cId, 1);
self::assertEquals($vote->comment, $voteR->comment);
self::assertEquals($vote->createdBy, $voteR->createdBy);
}
}