| @@ 72-91 (lines=20) @@ | ||
| 69 | $this->statementRepository->findStatementsBy($filter); |
|
| 70 | } |
|
| 71 | ||
| 72 | public function testSave() |
|
| 73 | { |
|
| 74 | $statement = StatementFixtures::getMinimalStatement(); |
|
| 75 | $this |
|
| 76 | ->mappedStatementRepository |
|
| 77 | ->expects($this->once()) |
|
| 78 | ->method('storeStatement') |
|
| 79 | ->with( |
|
| 80 | $this->callback(function (MappedStatement $mappedStatement) use ($statement) { |
|
| 81 | $expected = MappedStatement::fromModel($statement); |
|
| 82 | $actual = clone $mappedStatement; |
|
| 83 | $actual->stored = null; |
|
| 84 | ||
| 85 | return $expected == $actual; |
|
| 86 | }), |
|
| 87 | true |
|
| 88 | ); |
|
| 89 | ||
| 90 | $this->statementRepository->storeStatement($statement); |
|
| 91 | } |
|
| 92 | ||
| 93 | public function testSaveWithoutFlush() |
|
| 94 | { |
|
| @@ 93-112 (lines=20) @@ | ||
| 90 | $this->statementRepository->storeStatement($statement); |
|
| 91 | } |
|
| 92 | ||
| 93 | public function testSaveWithoutFlush() |
|
| 94 | { |
|
| 95 | $statement = StatementFixtures::getMinimalStatement(); |
|
| 96 | $this |
|
| 97 | ->mappedStatementRepository |
|
| 98 | ->expects($this->once()) |
|
| 99 | ->method('storeStatement') |
|
| 100 | ->with( |
|
| 101 | $this->callback(function (MappedStatement $mappedStatement) use ($statement) { |
|
| 102 | $expected = MappedStatement::fromModel($statement); |
|
| 103 | $actual = clone $mappedStatement; |
|
| 104 | $actual->stored = null; |
|
| 105 | ||
| 106 | return $expected == $actual; |
|
| 107 | }), |
|
| 108 | false |
|
| 109 | ); |
|
| 110 | ||
| 111 | $this->statementRepository->storeStatement($statement, false); |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * @return \PHPUnit_Framework_MockObject_MockObject|\XApi\Repository\Doctrine\Repository\Mapping\StatementRepository |
|