test path fixes

This commit is contained in:
Dennis Eichhorn 2020-03-28 16:27:02 +01:00
parent 885141d71b
commit baacc6f850
3 changed files with 43 additions and 3 deletions

38
Models/NullComment.php Normal file
View File

@ -0,0 +1,38 @@
<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package Modules\Comment\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\Comments\Models;
/**
* Null model
*
* @package Modules\Comment\Models
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
final class NullComment extends Comment
{
/**
* Constructor
*
* @param int $id Model id
*
* @since 1.0.0
*/
public function __construct(int $id = 0)
{
$this->id = $id;
}
}

View File

@ -17,6 +17,7 @@ namespace Modules\Comments\tests\Models;
use Modules\Admin\Models\NullAccount;
use Modules\Comments\Models\Comment;
use Modules\Comments\Models\CommentMapper;
use Phan\Language\Element\Comment\NullComment;
/**
* @internal
@ -29,7 +30,7 @@ class CommentMapperTest extends \PHPUnit\Framework\TestCase
$comment->setCreatedBy(new NullAccount(1));
$comment->setTitle('Test Title');
$comment->setContent('Test Content');
$comment->setRef(1);
$comment->setRef(null);
$comment->setList(1);
$id = CommentMapper::create($comment);

View File

@ -16,6 +16,7 @@ namespace Modules\Comments\tests\Models;
use Modules\Admin\Models\NullAccount;
use Modules\Comments\Models\Comment;
use Modules\Comments\Models\NullComment;
/**
* @internal
@ -46,8 +47,8 @@ class CommentTest extends \PHPUnit\Framework\TestCase
$comment->setList(2);
self::assertEquals(2, $comment->getList());
$comment->setRef(3);
self::assertEquals(3, $comment->getRef());
$comment->setRef(new NullComment(3));
self::assertEquals(3, $comment->getRef()->getId());
$comment->setTitle('Test Title');
self::assertEquals('Test Title', $comment->getTitle());