function it_is_equal_to_statement_ids_with_equal_value() { $value = '39e24cc4-69af-4b01-a824-1fdc6ea8a3af'; $uuid = Uuid::fromString($value); $this->beConstructedThrough('fromUuid', array($uuid)); $this->equals(StatementId::fromString($value))->shouldReturn(true); $this->equals(StatementId::fromUuid(Uuid::fromString($value)))->shouldReturn(true); $this->equals(StatementId::fromUuid($uuid))->shouldReturn(true); }
/** * {@inheritdoc} */ public final function storeStatement(Statement $statement, $flush = true) { if (null === $statement->getId()) { $statement = $statement->withId(StatementId::fromUuid(Uuid::uuid4())); } $mappedStatement = MappedStatement::fromModel($statement); $mappedStatement->stored = time(); $this->repository->storeStatement($mappedStatement, $flush); return $statement->getId(); }
public function testFindStatementById() { $statementId = StatementId::fromUuid(Uuid::uuid4()); $this->mappedStatementRepository->expects($this->once())->method('findStatement')->with(array('id' => $statementId->getValue()))->will($this->returnValue(MappedStatement::fromModel(StatementFixtures::getMinimalStatement()))); $this->statementRepository->findStatementById($statementId); }
public function getObjectsToValidate() { $withStatementId = new StatementReference(StatementId::fromUuid(Uuid::uuid4())); return array(array($withStatementId, 0)); }
function it_triggers_a_conflict_if_id_parameter_and_statement_id_do_not_match() { $statement = StatementFixtures::getTypicalStatement(); $statementId = StatementId::fromUuid(Uuid::uuid4()); $this->shouldThrow('Xabbuh\\XApi\\Common\\Exception\\ConflictException')->during('putStatement', array($statementId, $statement)); }