/** * @test * @dataProvider providePersistence * @param Persistence $persistence */ public function retrieved_AggregateRoot_should_behave_the_same_as_the_original_AggregateRoot(Persistence $persistence) { $unitOfWork = $this->buildUnitOfWork($persistence); $repository = new OrderRepository($unitOfWork); $this->order->pay(50); $repository->add($this->order); $unitOfWork->commit(); $retrievedOrder = $repository->get($this->orderId); $retrievedOrder->pay(50); $changes = $retrievedOrder->getChanges(); $this->assertInstanceOf(OrderWasPaidInFull::class, $changes[1]); }
/** * @test */ public function it_should_record_new_changes() { $this->order->clearChanges(); $this->order->pay(50); $this->assertCount(1, $this->order->getChanges()); }