|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Traits\Identity; |
|
4
|
|
|
|
|
5
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\AbstractIntegrationTest; |
|
6
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Objects\Identity\FullNameEmbeddable; |
|
7
|
|
|
|
|
8
|
|
|
class HasFullNameEmbeddableTraitIntegrationTest extends AbstractIntegrationTest |
|
9
|
|
|
{ |
|
10
|
|
|
public const WORK_DIR = AbstractIntegrationTest::VAR_PATH.'/' |
|
11
|
|
|
.self::TEST_TYPE.'/HasFullNameEmbeddableTraitIntegrationTest'; |
|
12
|
|
|
|
|
13
|
|
|
private const TEST_ENTITY = self::TEST_PROJECT_ROOT_NAMESPACE.'\\Entities\\Person'; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @var HasFullNameEmbeddableTrait |
|
17
|
|
|
*/ |
|
18
|
|
|
private $entity; |
|
19
|
|
|
|
|
20
|
|
|
public function setup() |
|
21
|
|
|
{ |
|
22
|
|
|
parent::setup(); |
|
23
|
|
|
$this->getEntityGenerator()->generateEntity(self::TEST_ENTITY); |
|
24
|
|
|
$this->getEntityEmbeddableSetter() |
|
25
|
|
|
->setEntityHasEmbeddable(self::TEST_ENTITY, HasFullNameEmbeddableTrait::class); |
|
26
|
|
|
$this->setupCopiedWorkDir(); |
|
27
|
|
|
$entityFqn = $this->getCopiedFqn(self::TEST_ENTITY); |
|
28
|
|
|
$this->entity = new $entityFqn; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @throws \EdmondsCommerce\DoctrineStaticMeta\Exception\DoctrineStaticMetaException |
|
33
|
|
|
* @throws \ReflectionException |
|
34
|
|
|
* @test |
|
35
|
|
|
* @medium |
|
36
|
|
|
* @covers \EdmondsCommerce\DoctrineStaticMeta\CodeGeneration\Generator\Embeddable\EntityEmbeddableSetter |
|
37
|
|
|
*/ |
|
38
|
|
|
public function generatedCodePassesQa() |
|
39
|
|
|
{ |
|
40
|
|
|
$this->assertTrue($this->qaGeneratedCode()); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @test |
|
45
|
|
|
* @medium |
|
46
|
|
|
* @covers \EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Traits\Identity\HasFullNameEmbeddableTrait |
|
47
|
|
|
*/ |
|
48
|
|
|
public function theEmbeddableCanBeSettedAndGetted() |
|
49
|
|
|
{ |
|
50
|
|
|
$expected = (new FullNameEmbeddable())->setFirstName('Rob'); |
|
51
|
|
|
$this->entity->setFullNameEmbeddable($expected); |
|
52
|
|
|
$actual = $this->entity->getFullNameEmbeddable(); |
|
53
|
|
|
$this->assertSame($expected, $actual); |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|