setDestination((new Destination())->setHotelCode('SERZIL')); $this->assertSame('ZIL', StatisticsDimensions::forAssignment($assignment)['hotel_code']); } public function testKeepsAnUnprefixedHotelCodeAsItIs(): void { $assignment = (new Assignment())->setDestination((new Destination())->setHotelCode('SBW')); $this->assertSame('SBW', StatisticsDimensions::forAssignment($assignment)['hotel_code']); } public function testADispositionCarriesItsTeamerAndTheAssignmentDimensions(): void { $teamer = new Teamer(); $assignment = (new Assignment())->setDestination((new Destination())->setHotelCode('SERZIL')); $disposition = new Disposition(new Application($assignment, $teamer)); $dimensions = StatisticsDimensions::forDisposition($disposition); $this->assertArrayHasKey('disposition_id', $dimensions); $this->assertSame($teamer->getId(), $dimensions['teamer_id']); $this->assertSame('ZIL', $dimensions['hotel_code']); } /** * A disposition can lose its assignment or teamer; the columns just go null, they do not * blow up the flush that is trying to record the event. */ public function testDegradesToNullWithoutAnAssignmentOrTeamer(): void { $disposition = new Disposition(new Application(new Assignment(), new Teamer())); $disposition->setAssignment(null); $disposition->setTeamer(null); $dimensions = StatisticsDimensions::forDisposition($disposition); $this->assertNull($dimensions['assignment_id']); $this->assertNull($dimensions['destination_id']); $this->assertNull($dimensions['hotel_code']); $this->assertNull($dimensions['teamer_id']); } }