1
0
Fork 0
This repository has been archived on 2021-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
my-todo-list/tests/IdManagerTest.php

33 lines
976 B
PHP
Raw Normal View History

2021-09-20 12:54:57 +02:00
<?php declare(strict_types=1);
2021-09-20 12:53:56 +02:00
use MMK2410\MyTodoList\IdManager;
use PHPUnit\Framework\TestCase;
class IdManagerTest extends TestCase
{
2021-09-20 12:54:57 +02:00
public function testGenerateTwoIds(): void
{
$id1 = IdManager::generateID(IdManagerTest::class . "::testGenerateTwoIds");
$id2 = IdManager::generateID(IdManagerTest::class . "::testGenerateTwoIds");
self::assertNotEquals(
$id1,
$id2,
"ID 1 '$id1' and ID 2 '$id2' are equal, but the shouldn't."
);
}
2021-09-20 12:53:56 +02:00
2021-09-20 12:54:57 +02:00
public function testGetCurrentId(): void
{
for ($i = 0; $i < 3; $i++) {
IdManager::generateID(IdManagerTest::class . "::testGetCurrentId()");
}
$currentId = IdManager::getCurrentId(IdManagerTest::class . "::testGetCurrentId()");
self::assertEquals(
2,
$currentId,
"Expected current ID to be '2', but got '$currentId'"
);
}
2021-09-20 12:53:56 +02:00
}