/** * @test */ public function it_is_not_same_value_as_itinerary_with_other_list_of_legs() { $legs = [LegFixture::get(LegFixture::HONGKONG_NEWYORK), LegFixture::get(LegFixture::NEWYORK_HAMBURG)]; $itinerary = new Itinerary($legs); $otherLegs = [LegFixture::get(LegFixture::HONGKONG_HAMBURG), LegFixture::get(LegFixture::HAMBURG_ROTTERDAM)]; $otherItinerary = new Itinerary($otherLegs); $this->assertFalse($itinerary->sameValueAs($otherItinerary)); }
/** * @test */ public function it_assigns_cargo_to_route_described_by_itinerary() { $routeSpecification = new RouteSpecification("Hongkong", "Hamburg"); $cargo = new Cargo(new TrackingId(Uuid::uuid4()), $routeSpecification); $legs = [LegFixture::get(LegFixture::HONGKONG_NEWYORK), LegFixture::get(LegFixture::NEWYORK_HAMBURG)]; $itinerary = new Itinerary($legs); $cargo->assignToRoute($itinerary); $this->assertTrue($itinerary->sameValueAs($cargo->itinerary())); }
/** * @test */ public function it_stores_and_returns_a_cargo() { $trackingId = $this->cargoRepository->getNextTrackingId(); $routeSpecification = new RouteSpecification("Hongkong", "Hamburg"); $cargo = new Cargo\Cargo($trackingId, $routeSpecification); $legs = [LegFixture::get(LegFixture::HONGKONG_NEWYORK), LegFixture::get(LegFixture::NEWYORK_HAMBURG)]; $itinerary = new Cargo\Itinerary($legs); $cargo->assignToRoute($itinerary); $this->cargoRepository->store($cargo); $this->getTestEntityManager()->clear(); $checkCargo = $this->cargoRepository->get($trackingId); $this->assertTrue($cargo->sameIdentityAs($checkCargo)); $this->assertTrue($itinerary->sameValueAs($checkCargo->itinerary())); }