mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-11-10 07:56:14 +01:00
eeda862e77
The `Product` namespace segment in the domain model namespace `TTN\Tea\Domain\Model` currently serves no purpose and only adds confusion. So let's simplify the extension structure accordingly. (I intended to use this to demonstrate DDD contexts, but never built enough models in the Tea extension for this to actually make sense.) Fixes #1008
109 lines
2.2 KiB
PHP
109 lines
2.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace TTN\Tea\Tests\Unit\Domain\Model;
|
|
|
|
use TTN\Tea\Domain\Model\Tea;
|
|
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
|
|
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
|
|
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
|
|
|
|
/**
|
|
* @covers \TTN\Tea\Domain\Model\Tea
|
|
*/
|
|
final class TeaTest extends UnitTestCase
|
|
{
|
|
private \TTN\Tea\Domain\Model\Tea $subject;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->subject = new Tea();
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function isAbstractEntity(): void
|
|
{
|
|
self::assertInstanceOf(AbstractEntity::class, $this->subject);
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function getTitleInitiallyReturnsEmptyString(): void
|
|
{
|
|
self::assertSame('', $this->subject->getTitle());
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function setTitleSetsTitle(): void
|
|
{
|
|
$value = 'Club-Mate';
|
|
$this->subject->setTitle($value);
|
|
|
|
self::assertSame($value, $this->subject->getTitle());
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function getDescriptionInitiallyReturnsEmptyString(): void
|
|
{
|
|
self::assertSame('', $this->subject->getDescription());
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function setDescriptionSetsDescription(): void
|
|
{
|
|
$value = 'Club-Mate';
|
|
$this->subject->setDescription($value);
|
|
|
|
self::assertSame($value, $this->subject->getDescription());
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function getImageInitiallyReturnsNull(): void
|
|
{
|
|
self::assertNull($this->subject->getImage());
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function setImageSetsImage(): void
|
|
{
|
|
$model = new FileReference();
|
|
$this->subject->setImage($model);
|
|
|
|
self::assertSame($model, $this->subject->getImage());
|
|
}
|
|
|
|
/**
|
|
* @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());
|
|
}
|
|
}
|