public function testSaveWithoutFlush() { $statement = StatementFixtures::getMinimalStatement(); $this->mappedStatementRepository->expects($this->once())->method('storeStatement')->with($this->callback(function (MappedStatement $mappedStatement) use($statement) { $expected = MappedStatement::fromModel($statement); $actual = clone $mappedStatement; $actual->stored = null; return $expected == $actual; }), false); $this->statementRepository->storeStatement($statement, false); }
/** * {@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 testCallToFlushCanBeSuppressed() { $this->objectManager->expects($this->never())->method('flush'); $mappedStatement = Statement::fromModel(StatementFixtures::getMinimalStatement()); $this->repository->storeStatement($mappedStatement, false); }