/** @test */ public function should_test_equality() { $one = ManufacturerId::fromString('d16f9fe7-e947-460e-99f6-2d64d65f46bc'); $two = ManufacturerId::fromString('d16f9fe7-e947-460e-99f6-2d64d65f46bc'); $three = ManufacturerId::generate(); $this->assertTrue($one->equals($two)); $this->assertFalse($one->equals($three)); }
/** * Create a Part in the event store as well as in the read model * @param Request $request * @return Response */ public function store(Request $request) { $partId = PartId::generate(); $manufacturerId = ManufacturerId::generate(); $command = new ManufacturePartCommand($partId, $manufacturerId, $request->get('manufacturer-name')); $this->commandBus->dispatch($command); return Redirect::route('parts.index')->with('success', 'Part successfully created.'); }
/** * @test */ public function it_can_manufacture() { $partId = PartId::generate(); $manufacturerId = ManufacturerId::generate(); $this->scenario->withAggregateId($partId->toString())->given([])->when(new ManufacturePartCommand($partId, $manufacturerId, 'Acme, Inc'))->then([new PartWasManufacturedEvent($partId, $manufacturerId, 'Acme, Inc')]); }
/** * @return \Modules\Core\Domain\Identifier */ private function makeManufacturerId() { $id = ManufacturerId::generate(); return ManufacturerId::fromString($id); }