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