mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-09-19 17:56:12 +02:00

Mark tests to be demonstrated during the workshop

This commit is contained in:
Oliver Klee 2022-06-18 18:01:23 +02:00
parent efbc9335a6
commit 33c777d054
4 changed files with 28 additions and 89 deletions

View file

@ -36,9 +36,7 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/
public function findAllForNoRecordsReturnsEmptyContainer(): void
{
$result = $this->subject->findAll();
self::assertCount(0, $result);
self::markTestIncomplete('Code me!');
}
/**
@ -46,11 +44,7 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/
public function findAllWithRecordsFindsRecordsFromAllPages(): void
{
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaOnPage.csv');
$result = $this->subject->findAll();
self::assertCount(1, $result);
self::markTestIncomplete('Code me!');
}
/**
@ -58,12 +52,7 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/
public function findAllSortsByTitleInAscendingOrder(): void
{
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TwoUnsortedTeas.csv');
$result = $this->subject->findAll();
$result->rewind();
self::assertSame(2, $result->current()->getUid());
self::markTestIncomplete('Code me!');
}
/**
@ -81,11 +70,7 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/
public function findByUidForExistingRecordReturnsModel(): void
{
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithAllScalarData.csv');
$model = $this->subject->findByUid(1);
self::assertInstanceOf(Tea::class, $model);
self::markTestIncomplete('Code me!');
}
/**
@ -93,14 +78,9 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/
public function findByUidForExistingRecordMapsAllScalarData(): void
{
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithAllScalarData.csv');
self::markTestIncomplete('Code me!');
$model = $this->subject->findByUid(1);
self::assertInstanceOf(Tea::class, $model);
self::assertSame('Earl Grey', $model->getTitle());
self::assertSame('Fresh and hot.', $model->getDescription());
self::assertSame(2, $model->getOwnerUid());
// @todo: title, description
}
/**
@ -108,13 +88,7 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/
public function fillsImageRelation(): void
{
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithImage.csv');
$model = $this->subject->findByUid(1);
$image = $model->getImage();
self::assertInstanceOf(FileReference::class, $image);
self::assertSame(1, $image->getUid());
self::markTestIncomplete('Code me!');
}
/**
@ -122,14 +96,7 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/
public function addAndPersistAllCreatesNewRecord(): void
{
$title = 'Godesberger Burgtee';
$model = new Tea();
$model->setTitle($title);
$this->subject->add($model);
$this->persistenceManager->persistAll();
$this->assertCSVDataSet(__DIR__ . '/../Fixtures/Product/PersistedTea.csv');
self::markTestIncomplete('Code me!');
}
/**
@ -137,11 +104,7 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/
public function findByOwnerUidFindsTeaWithTheGivenOwnerUid(): void
{
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithOwner.csv');
$result = $this->subject->findByOwnerUid(1);
self::assertCount(1, $result);
self::markTestIncomplete('Code me!');
}
/**
@ -149,11 +112,7 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/
public function findByOwnerUidFindsIgnoresTeaWithNonMatchingOwnerUid(): void
{
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithOwner.csv');
$result = $this->subject->findByOwnerUid(2);
self::assertCount(0, $result);
self::markTestIncomplete('Code me!');
}
/**
@ -161,11 +120,7 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/
public function findByOwnerUidFindsIgnoresTeaWithZeroOwnerUid(): void
{
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithoutOwner.csv');
$result = $this->subject->findByOwnerUid(1);
self::assertCount(0, $result);
self::markTestIncomplete('Code me!');
}
/**
@ -173,11 +128,6 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/
public function findByOwnerUidSortsByTitleInAscendingOrder(): void
{
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TwoTeasWithOwner.csv');
$result = $this->subject->findByOwnerUid(1);
$result->rewind();
self::assertSame(2, $result->current()->getUid());
self::markTestIncomplete('Code me!');
}
}

View file

@ -60,7 +60,7 @@ final class TeaControllerTest extends UnitTestCase
*/
public function isActionController(): void
{
self::assertInstanceOf(ActionController::class, $this->subject);
self::markTestIncomplete('Code me!');
}
/**
@ -68,11 +68,7 @@ final class TeaControllerTest extends UnitTestCase
*/
public function indexActionAssignsAllTeaAsTeasToView(): void
{
$teas = $this->createStub(QueryResultInterface::class);
$this->teaRepositoryMock->method('findAll')->willReturn($teas);
$this->viewMock->expects(self::once())->method('assign')->with('teas', $teas);
$this->subject->indexAction();
self::markTestIncomplete('Code me!');
}
/**
@ -90,10 +86,7 @@ final class TeaControllerTest extends UnitTestCase
*/
public function showActionAssignsPassedTeaAsTeaToView(): void
{
$tea = new Tea();
$this->viewMock->expects(self::once())->method('assign')->with('tea', $tea);
$this->subject->showAction($tea);
self::markTestIncomplete('Code me!');
}
/**

View file

@ -20,7 +20,7 @@ final class TeaTest extends UnitTestCase
{
parent::setUp();
$this->subject = new Tea();
// @todo: build subject
}
/**
@ -28,7 +28,7 @@ final class TeaTest extends UnitTestCase
*/
public function isAbstractEntity(): void
{
self::assertInstanceOf(AbstractEntity::class, $this->subject);
self::markTestIncomplete('Code me!');
}
/**
@ -36,7 +36,7 @@ final class TeaTest extends UnitTestCase
*/
public function getTitleInitiallyReturnsEmptyString(): void
{
self::assertSame('', $this->subject->getTitle());
self::markTestIncomplete('Code me!');
}
/**
@ -44,10 +44,8 @@ final class TeaTest extends UnitTestCase
*/
public function setTitleSetsTitle(): void
{
$value = 'Club-Mate';
$this->subject->setTitle($value);
self::markTestIncomplete('Code me!');
self::assertSame($value, $this->subject->getTitle());
}
/**
@ -55,7 +53,7 @@ final class TeaTest extends UnitTestCase
*/
public function getDescriptionInitiallyReturnsEmptyString(): void
{
self::assertSame('', $this->subject->getDescription());
self::markTestIncomplete('Code me!');
}
/**
@ -63,10 +61,7 @@ final class TeaTest extends UnitTestCase
*/
public function setDescriptionSetsDescription(): void
{
$value = 'Club-Mate';
$this->subject->setDescription($value);
self::assertSame($value, $this->subject->getDescription());
self::markTestIncomplete('Code me!');
}
/**
@ -74,7 +69,7 @@ final class TeaTest extends UnitTestCase
*/
public function getImageInitiallyReturnsNull(): void
{
self::assertNull($this->subject->getImage());
self::markTestIncomplete('Code me!');
}
/**
@ -82,10 +77,7 @@ final class TeaTest extends UnitTestCase
*/
public function setImageSetsImage(): void
{
$model = new FileReference();
$this->subject->setImage($model);
self::assertSame($model, $this->subject->getImage());
self::markTestIncomplete('Code me!');
}
/**

View file

@ -20,6 +20,7 @@ final class TeaRepositoryTest extends UnitTestCase
{
parent::setUp();
<<<<<<< HEAD
if (\interface_exists(ObjectManagerInterface::class)) {
$objectManagerStub = $this->createStub(ObjectManagerInterface::class);
// @phpstan-ignore-next-line This line is 11LTS-specific, but we're running PHPStan on TYPO3 12.
@ -27,6 +28,9 @@ final class TeaRepositoryTest extends UnitTestCase
} else {
$this->subject = new TeaRepository();
}
=======
// @todo: create subject with `ObjectManagerInterface` stub
>>>>>>> cc534d5 (Mark tests to be demonstrated during the workshop)
}
/**
@ -34,6 +38,6 @@ final class TeaRepositoryTest extends UnitTestCase
*/
public function isRepository(): void
{
self::assertInstanceOf(Repository::class, $this->subject);
self::markTestIncomplete('Code me!');
}
}