@pelshoff final class MeetingService { private MeetingRepository $repository; private Clock $clock; public function __construct(/**/) {/**/} public function getCurrentMeetings(): array { $range = new ClosedDateTimeRange($this->clock->now(), $this->clock->now('+1 month')); return array_map( fn (Meeting $meeting) => $meeting->view(), $this->repository->findMeetingsBySpecification( new IsPublishedDuring($range) ) ); } } No input! Context Context Context
@pelshoff 1, 2... // Integration/DB or Unit+Mock function testThatNewRegistrationsAreSaved() function testThatRegistrationsAreUpdatedAndSaved() function testThatXyAndZAndSaved() many // Integration/DB function testThatTheAggregateCanBeSaved() function testThatSpecialCircumstancesAlsoIntegrateWell() // Unit function testThatBusinessLogicWorksAsExpected() function testThatTheyDontRequireManyMocks() function testThatIfEvenAnyAtAll() function testThatItMakesYouHappierAndMoreProductive()
@pelshoff Heuristics anything that provides a plausible aid or direction in the solution of a problem but is in the final analysis unjustified, incapable of justification, and potentially fallible. -Billy Vaughn Koen https://www.dddheuristics.com/