Skip to content

Commit

Permalink
test for combination of partials and not loaded embedables
Browse files Browse the repository at this point in the history
  • Loading branch information
VasekPurchart committed Sep 16, 2017
1 parent b47d382 commit fb9892b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/Enum/LoadEnumToEntityIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ public function testLoadEnumInEmbeddableWeNeedToGoDeeper()
$this->assertSame(FooEnum::get(FooEnum::ONE), $foo->getEmbedded()->getEmbedded()->getEnum());
}

public function testLoadEnumInNotLoadedEmbeddable()
{
$foo = new FooEntity();
$this->callPostLoadEventOnEntity($foo);

$this->assertNull($foo->getNotLoadedEmbedded());
}

public function testLoadEnumMissingEnumClass()
{
$this->expectException(\Doctrine\Common\Annotations\AnnotationException::class);
Expand Down
16 changes: 16 additions & 0 deletions tests/Enum/data/FooEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ class FooEntity extends \Consistence\Doctrine\Enum\FooParentEntity
*/
private $embedded;

/**
* This simulates for example using partials where this was not selected
*
* @ORM\Embedded(class=FooEmbeddable::class, columnPrefix="not_loaded_")
* @var \Consistence\Doctrine\Enum\FooEmbeddable
*/
private $notLoadedEmbedded;

public function __construct()
{
$this->embedded = new FooEmbeddable();
Expand Down Expand Up @@ -68,4 +76,12 @@ public function getEmbedded(): FooEmbeddable
return $this->embedded;
}

/**
* @return \Consistence\Doctrine\Enum\FooEmbeddable
*/
public function getNotLoadedEmbedded()
{
return $this->notLoadedEmbedded;
}

}

0 comments on commit fb9892b

Please sign in to comment.