Skip to content

Commit

Permalink
use reflection to set id of example entity
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes committed Sep 30, 2021
1 parent 35cf9dd commit 8e6fe08
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
10 changes: 0 additions & 10 deletions Tests/Application/ExampleTestBundle/Entity/Example.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,6 @@ public function getId()
return $this->id;
}

/**
* @param mixed $id
*/
public function setId($id): self
{
$this->id = $id;

return $this;
}

public function createDimensionContent(): DimensionContentInterface
{
return new ExampleDimensionContent($this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ public function testGetSubscribedEvents(): void
public function testPreRemove(): void
{
$object = new Example();
$object->setId('123-123-123');
$property = new \ReflectionProperty(Example::class, 'id');
$property->setAccessible(true);
$property->setValue($object, '123-123-123');

$this->contentMetadataInspector->getDimensionContentClass(Example::class)
->willReturn(ExampleDimensionContent::class);
Expand All @@ -104,7 +106,9 @@ public function testPreRemove(): void
public function testPreRemoveNoMappingConfigured(): void
{
$object = new Example();
$object->setId('123-123-123');
$property = new \ReflectionProperty(Example::class, 'id');
$property->setAccessible(true);
$property->setValue($object, '123-123-123');

$this->contentMetadataInspector->getDimensionContentClass(Example::class)
->willReturn(self::class); // For testing purpose we return the wrong dimension content class
Expand Down

0 comments on commit 8e6fe08

Please sign in to comment.