| @@ 20-45 (lines=26) @@ | ||
| 17 | * Class PlayerTest |
|
| 18 | * @package Tfboe\FmLib\Tests\Unit\Entity |
|
| 19 | */ |
|
| 20 | class NumericalPlayerIdTest extends UnitTestCase |
|
| 21 | { |
|
| 22 | //<editor-fold desc="Public Methods"> |
|
| 23 | /** |
|
| 24 | * @covers \Tfboe\FmLib\Entity\Helpers\NumericalPlayerId::getPlayerId |
|
| 25 | */ |
|
| 26 | public function testId() |
|
| 27 | { |
|
| 28 | $player = $this->player(); |
|
| 29 | /** @noinspection PhpUnhandledExceptionInspection */ |
|
| 30 | $idProperty = self::getProperty(get_class($player), 'playerId'); |
|
| 31 | $idProperty->setValue($player, 0); |
|
| 32 | self::assertEquals(0, $player->getPlayerId()); |
|
| 33 | } |
|
| 34 | //</editor-fold desc="Public Methods"> |
|
| 35 | ||
| 36 | //<editor-fold desc="Private Methods"> |
|
| 37 | /** |
|
| 38 | * @return NumericalPlayerId|MockObject a new player |
|
| 39 | */ |
|
| 40 | private function player(): MockObject |
|
| 41 | { |
|
| 42 | return $this->getMockForTrait(NumericalPlayerId::class); |
|
| 43 | } |
|
| 44 | //</editor-fold desc="Private Methods"> |
|
| 45 | } |
|
| @@ 22-47 (lines=26) @@ | ||
| 19 | * Class BaseEntityTest |
|
| 20 | * @package Tfboe\FmLib\Tests\Unit\Entity\Helpers |
|
| 21 | */ |
|
| 22 | class UUIDEntityTest extends UnitTestCase |
|
| 23 | { |
|
| 24 | //<editor-fold desc="Public Methods"> |
|
| 25 | /** |
|
| 26 | * @covers \Tfboe\FmLib\Entity\Helpers\UUIDEntity::getId |
|
| 27 | * @uses \Tfboe\FmLib\Entity\Helpers\IdGenerator::createIdFrom |
|
| 28 | */ |
|
| 29 | public function testId() |
|
| 30 | { |
|
| 31 | $entity = $this->mock(); |
|
| 32 | /** @noinspection PhpUnhandledExceptionInspection */ |
|
| 33 | self::getProperty(get_class($entity), 'id')->setValue($entity, 'test-id'); |
|
| 34 | self::assertEquals('test-id', $entity->getId()); |
|
| 35 | } |
|
| 36 | //</editor-fold desc="Public Methods"> |
|
| 37 | ||
| 38 | //<editor-fold desc="Private Methods"> |
|
| 39 | /** |
|
| 40 | * @return MockObject|UUIDEntity |
|
| 41 | */ |
|
| 42 | private function mock(): MockObject |
|
| 43 | { |
|
| 44 | return $this->getMockForTrait(UUIDEntity::class); |
|
| 45 | } |
|
| 46 | //</editor-fold desc="Private Methods"> |
|
| 47 | } |
|