2018-05-25 16:19:12 +02:00
|
|
|
<?php
|
2019-12-07 12:13:32 +01:00
|
|
|
|
2019-08-12 17:25:59 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2024-01-16 15:21:21 +01:00
|
|
|
namespace TTN\Tea\Tests\Unit\Domain\Model;
|
2018-05-25 16:19:12 +02:00
|
|
|
|
2024-01-16 15:21:21 +01:00
|
|
|
use TTN\Tea\Domain\Model\Tea;
|
2018-05-25 22:39:33 +02:00
|
|
|
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
|
2018-05-25 16:19:12 +02:00
|
|
|
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
|
2022-02-20 15:18:46 +01:00
|
|
|
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
|
2018-05-25 16:19:12 +02:00
|
|
|
|
|
|
|
/**
|
2024-01-16 15:21:21 +01:00
|
|
|
* @covers \TTN\Tea\Domain\Model\Tea
|
2018-05-25 16:19:12 +02:00
|
|
|
*/
|
2023-04-06 16:34:15 +02:00
|
|
|
final class TeaTest extends UnitTestCase
|
2018-05-25 16:19:12 +02:00
|
|
|
{
|
2024-01-23 20:39:13 +01:00
|
|
|
private Tea $subject;
|
2018-05-25 16:19:12 +02:00
|
|
|
|
2019-08-12 17:25:59 +02:00
|
|
|
protected function setUp(): void
|
2018-05-25 16:19:12 +02:00
|
|
|
{
|
2022-02-20 15:18:46 +01:00
|
|
|
parent::setUp();
|
|
|
|
|
2018-05-25 16:19:12 +02:00
|
|
|
$this->subject = new Tea();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
2019-08-12 17:25:59 +02:00
|
|
|
public function isAbstractEntity(): void
|
2018-05-25 16:19:12 +02:00
|
|
|
{
|
2019-08-12 17:25:59 +02:00
|
|
|
self::assertInstanceOf(AbstractEntity::class, $this->subject);
|
2018-05-25 16:19:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
2019-08-12 17:25:59 +02:00
|
|
|
public function getTitleInitiallyReturnsEmptyString(): void
|
2018-05-25 16:19:12 +02:00
|
|
|
{
|
2019-08-12 17:25:59 +02:00
|
|
|
self::assertSame('', $this->subject->getTitle());
|
2018-05-25 16:19:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
2019-08-12 17:25:59 +02:00
|
|
|
public function setTitleSetsTitle(): void
|
2018-05-25 16:19:12 +02:00
|
|
|
{
|
2024-04-02 07:19:31 +02:00
|
|
|
$value = 'Earl Grey';
|
2018-05-25 16:19:12 +02:00
|
|
|
$this->subject->setTitle($value);
|
|
|
|
|
2019-08-12 17:25:59 +02:00
|
|
|
self::assertSame($value, $this->subject->getTitle());
|
2018-05-25 16:19:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
2019-08-12 17:25:59 +02:00
|
|
|
public function getDescriptionInitiallyReturnsEmptyString(): void
|
2018-05-25 16:19:12 +02:00
|
|
|
{
|
2019-08-12 17:25:59 +02:00
|
|
|
self::assertSame('', $this->subject->getDescription());
|
2018-05-25 16:19:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
2019-08-12 17:25:59 +02:00
|
|
|
public function setDescriptionSetsDescription(): void
|
2018-05-25 16:19:12 +02:00
|
|
|
{
|
2024-04-02 07:19:31 +02:00
|
|
|
$value = 'Very refreshing and amoratic.';
|
2018-05-25 16:19:12 +02:00
|
|
|
$this->subject->setDescription($value);
|
|
|
|
|
2019-08-12 17:25:59 +02:00
|
|
|
self::assertSame($value, $this->subject->getDescription());
|
2018-05-25 16:19:12 +02:00
|
|
|
}
|
2018-05-25 22:39:33 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
2019-08-12 17:25:59 +02:00
|
|
|
public function getImageInitiallyReturnsNull(): void
|
2018-05-25 22:39:33 +02:00
|
|
|
{
|
2019-08-12 17:25:59 +02:00
|
|
|
self::assertNull($this->subject->getImage());
|
2018-05-25 22:39:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
2019-08-12 17:25:59 +02:00
|
|
|
public function setImageSetsImage(): void
|
2018-05-25 22:39:33 +02:00
|
|
|
{
|
|
|
|
$model = new FileReference();
|
|
|
|
$this->subject->setImage($model);
|
|
|
|
|
2019-08-12 17:25:59 +02:00
|
|
|
self::assertSame($model, $this->subject->getImage());
|
2018-05-25 22:39:33 +02:00
|
|
|
}
|
2023-06-21 09:16:13 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
|
|
|
public function getOwnerUidInitiallyReturnsZero(): void
|
|
|
|
{
|
|
|
|
self::assertSame(0, $this->subject->getOwnerUid());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
|
|
|
public function setOwnerUidSetsOwnerUid(): void
|
|
|
|
{
|
|
|
|
$value = 123456;
|
|
|
|
$this->subject->setOwnerUid($value);
|
|
|
|
|
|
|
|
self::assertSame($value, $this->subject->getOwnerUid());
|
|
|
|
}
|
2018-05-25 16:19:12 +02:00
|
|
|
}
|