Skip to content
6 changes: 5 additions & 1 deletion src/Handler/EntityHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ protected function refreshDomainProperty(
}

// refresh the underlying domain object
$this->handlerLocator->get($datum)->refreshDomain($datum, $refresh);
$handler = $this->handlerLocator->get($datum);
if (!$handler instanceof MappedHandler) {
return;
}
$handler->refreshDomain($datum, $refresh);
}
}
12 changes: 12 additions & 0 deletions tests/ValueObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,17 @@ public function test()
];
$actual = $fakeRecord->getArrayCopy();
$this->assertEquals($expect, $actual);


// Test new entity
$newFakeEntity = new Fake(new Email('fake@example.com'),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your changes are related to the EntityHandler but this is the test class for a value object. Is this correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes because it's on the persist of a ValueObject.

Copy link
Copy Markdown

@froschdesign froschdesign Apr 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two suggestions for the test:

  1. Create a separate test method and use a name that describes the current testing process.
  2. At the moment the test did not perform any assertions, that should be changed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done ;)

new Address('456 Central',
'Bel Air',
'90007',
'CA'),
new DateTime('now'),
new Bag([]));
$this->transit->store($newFakeEntity);
$this->transit->persist();
}
}