public function it_can_be_compared_with_another_contract(Contract $contract) { $contract->toString()->shouldBeCalledTimes(2); $contract->toString()->willReturn('stdClass'); $this->equals($contract)->shouldReturn(false); $contract->toString()->willReturn($this->className); $this->equals($contract)->shouldReturn(true); }
/** * @param Contract $aggregateType * @param AggregateRootIdentifier $aggregateRootIdentifier * * @return EventStream */ public function read(Contract $aggregateType, AggregateRootIdentifier $aggregateRootIdentifier) { $statement = $this->selectQuery->prepare(); $statement->bindValue(':aggregate_id', $aggregateRootIdentifier->toString()); $statement->bindValue(':aggregate_type', $aggregateType->toString()); $statement->execute(); $records = $statement->fetchAll(); $statement->closeCursor(); return new PdoReadRecordEventStream($aggregateRootIdentifier, $records, $this->eventSerializer); }
/** * @depends testCanBeCreatedFromAClassName */ public function testCanBeTranslatedToAString(Contract $contract) { $this->assertEquals('\\stdClass', $contract->toString()); }