1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Large\Entity\Fields\Traits\PrimaryKey; |
4
|
|
|
|
5
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Interfaces\PrimaryKey\IdFieldInterface; |
6
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\PrimaryKey\IntegerIdFieldTrait; |
7
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\AbstractTest; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class UuidFieldTraitTest |
11
|
|
|
* |
12
|
|
|
* @package EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\PrimaryKey |
13
|
|
|
* @SuppressWarnings(PHPMD.DepthOfInheritance) |
14
|
|
|
*/ |
15
|
|
|
class IntegerIdFieldTraitTest extends IdFieldTraitTest |
16
|
|
|
{ |
17
|
|
|
public const WORK_DIR = AbstractTest::VAR_PATH . |
18
|
|
|
'/' . |
19
|
|
|
self::TEST_TYPE_LARGE . |
20
|
|
|
'/IntegerIdFieldTraitTest/'; |
21
|
|
|
protected const TEST_FIELD_FQN = IntegerIdFieldTrait::class; |
22
|
|
|
protected const TEST_FIELD_PROP = IdFieldInterface::PROP_ID; |
23
|
|
|
|
24
|
|
|
public function generateCode() |
25
|
|
|
{ |
26
|
|
|
$this->getEntityGenerator() |
27
|
|
|
->setUseUuidPrimaryKey(false) |
28
|
|
|
->generateEntity(static::TEST_ENTITY_FQN_BASE . $this->entitySuffix); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @test |
33
|
|
|
* @large |
34
|
|
|
* @covers \EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\PrimaryKey\IntegerIdFieldTrait |
35
|
|
|
* @throws \ReflectionException |
36
|
|
|
*/ |
37
|
|
|
public function createEntityWithField(): void |
38
|
|
|
{ |
39
|
|
|
parent::createEntityWithField(); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @test |
44
|
|
|
* @large |
45
|
|
|
* @covers \EdmondsCommerce\DoctrineStaticMeta\Entity\Fields\Traits\PrimaryKey\IntegerIdFieldTrait |
46
|
|
|
* @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException |
47
|
|
|
* @throws \ReflectionException |
48
|
|
|
*/ |
49
|
|
|
public function createDatabaseSchema() |
50
|
|
|
{ |
51
|
|
|
parent::createDatabaseSchema(); // TODO: Change the autogenerated stub |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
protected function validateSavedEntity($entity) |
55
|
|
|
{ |
56
|
|
|
$id = $entity->getId(); |
57
|
|
|
self::assertNotEmpty($id); |
58
|
|
|
self::assertInternalType('int', $id); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|