Skip to content

Commit 55be0e6

Browse files
committed
rename internal repository to StatementStorage
1 parent be59a70 commit 55be0e6

File tree

6 files changed

+26
-24
lines changed

6 files changed

+26
-24
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ CHANGELOG
44
0.4.0
55
-----
66

7+
* renamed the `StatementRepository` interface to `StatementStorage` and moved
8+
it to the `XApi\Repository\Doctrine\Storage` namespace
79
* made the package compatible with `3.x` releases of `ramsey/uuid`
810
* allow `2.x` releases of the `php-xapi/model` package too
911

src/Repository/StatementRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Xabbuh\XApi\Model\Uuid as ModelUuid;
2121
use XApi\Repository\Api\StatementRepositoryInterface;
2222
use XApi\Repository\Doctrine\Mapping\Statement as MappedStatement;
23-
use XApi\Repository\Doctrine\Repository\Mapping\StatementRepository as MappedStatementRepository;
23+
use XApi\Repository\Doctrine\Storage\StatementStorage;
2424

2525
/**
2626
* Doctrine based {@link Statement} repository.
@@ -31,7 +31,7 @@ final class StatementRepository implements StatementRepositoryInterface
3131
{
3232
private $repository;
3333

34-
public function __construct(MappedStatementRepository $repository)
34+
public function __construct(StatementStorage $repository)
3535
{
3636
$this->repository = $repository;
3737
}

src/Repository/Mapping/StatementRepository.php renamed to src/Storage/StatementStorage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace XApi\Repository\Doctrine\Repository\Mapping;
12+
namespace XApi\Repository\Doctrine\Storage;
1313

1414
use XApi\Repository\Doctrine\Mapping\Statement;
1515

@@ -18,7 +18,7 @@
1818
*
1919
* @author Christian Flothmann <[email protected]>
2020
*/
21-
interface StatementRepository
21+
interface StatementStorage
2222
{
2323
/**
2424
* @param array $criteria

src/Test/Functional/StatementRepositoryTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
use Doctrine\Common\Persistence\ObjectManager;
1515
use XApi\Repository\Api\Test\Functional\StatementRepositoryTest as BaseStatementRepositoryTest;
16-
use XApi\Repository\Doctrine\Repository\Mapping\StatementRepository as MappedStatementRepository;
1716
use XApi\Repository\Doctrine\Repository\StatementRepository;
17+
use XApi\Repository\Doctrine\Storage\StatementStorage;
1818
use XApi\Repository\Doctrine\Test\StatementRepository as FreshStatementRepository;
1919

2020
/**
@@ -28,26 +28,26 @@ abstract class StatementRepositoryTest extends BaseStatementRepositoryTest
2828
protected $objectManager;
2929

3030
/**
31-
* @var MappedStatementRepository
31+
* @var StatementStorage
3232
*/
33-
protected $repository;
33+
protected $storage;
3434

3535
protected function setUp()
3636
{
3737
$this->objectManager = $this->createObjectManager();
38-
$this->repository = $this->createRepository();
38+
$this->storage = $this->createStorage();
3939

4040
parent::setUp();
4141
}
4242

4343
protected function createStatementRepository()
4444
{
45-
return new FreshStatementRepository(new StatementRepository($this->repository), $this->objectManager);
45+
return new FreshStatementRepository(new StatementRepository($this->storage), $this->objectManager);
4646
}
4747

4848
protected function cleanDatabase()
4949
{
50-
foreach ($this->repository->findStatements(array()) as $statement) {
50+
foreach ($this->storage->findStatements(array()) as $statement) {
5151
$this->objectManager->remove($statement);
5252
}
5353

@@ -64,7 +64,7 @@ abstract protected function createObjectManager();
6464
*/
6565
abstract protected function getStatementClassName();
6666

67-
private function createRepository()
67+
private function createStorage()
6868
{
6969
return $this->objectManager->getRepository($this->getStatementClassName());
7070
}

src/Test/Unit/Repository/Mapping/StatementRepositoryTest.php renamed to src/Test/Unit/Storage/StatementStorageTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace XApi\Repository\Doctrine\Test\Unit\Repository\Mapping;
12+
namespace XApi\Repository\Doctrine\Test\Unit\Storage;
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Xabbuh\XApi\DataFixtures\StatementFixtures;
1616
use XApi\Repository\Doctrine\Mapping\Statement;
17-
use XApi\Repository\Doctrine\Repository\Mapping\StatementRepository;
17+
use XApi\Repository\Doctrine\Storage\StatementStorage;
1818

1919
/**
2020
* @author Christian Flothmann <[email protected]>
2121
*/
22-
abstract class StatementRepositoryTest extends TestCase
22+
abstract class StatementStorageTest extends TestCase
2323
{
2424
/**
2525
* @var \PHPUnit_Framework_MockObject_MockObject
@@ -37,16 +37,16 @@ abstract class StatementRepositoryTest extends TestCase
3737
private $classMetadata;
3838

3939
/**
40-
* @var StatementRepository
40+
* @var StatementStorage
4141
*/
42-
private $repository;
42+
private $storage;
4343

4444
protected function setUp()
4545
{
4646
$this->objectManager = $this->createObjectManagerMock();
4747
$this->unitOfWork = $this->createUnitOfWorkMock();
4848
$this->classMetadata = $this->createClassMetadataMock();
49-
$this->repository = $this->createMappedStatementRepository($this->objectManager, $this->unitOfWork, $this->classMetadata);
49+
$this->storage = $this->createStatementStorage($this->objectManager, $this->unitOfWork, $this->classMetadata);
5050
}
5151

5252
public function testStatementDocumentIsPersisted()
@@ -59,7 +59,7 @@ public function testStatementDocumentIsPersisted()
5959
;
6060

6161
$mappedStatement = Statement::fromModel(StatementFixtures::getMinimalStatement());
62-
$this->repository->storeStatement($mappedStatement, true);
62+
$this->storage->storeStatement($mappedStatement, true);
6363
}
6464

6565
public function testFlushIsCalledByDefault()
@@ -71,7 +71,7 @@ public function testFlushIsCalledByDefault()
7171
;
7272

7373
$mappedStatement = Statement::fromModel(StatementFixtures::getMinimalStatement());
74-
$this->repository->storeStatement($mappedStatement);
74+
$this->storage->storeStatement($mappedStatement);
7575
}
7676

7777
public function testCallToFlushCanBeSuppressed()
@@ -83,7 +83,7 @@ public function testCallToFlushCanBeSuppressed()
8383
;
8484

8585
$mappedStatement = Statement::fromModel(StatementFixtures::getMinimalStatement());
86-
$this->repository->storeStatement($mappedStatement, false);
86+
$this->storage->storeStatement($mappedStatement, false);
8787
}
8888

8989
abstract protected function getObjectManagerClass();
@@ -116,5 +116,5 @@ protected function createClassMetadataMock()
116116
->getMock();
117117
}
118118

119-
abstract protected function createMappedStatementRepository($objectManager, $unitOfWork, $classMetadata);
119+
abstract protected function createStatementStorage($objectManager, $unitOfWork, $classMetadata);
120120
}

tests/Unit/Repository/StatementRepositoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
class StatementRepositoryTest extends TestCase
2828
{
2929
/**
30-
* @var \PHPUnit_Framework_MockObject_MockObject|\XApi\Repository\Doctrine\Repository\Mapping\StatementRepository
30+
* @var \PHPUnit_Framework_MockObject_MockObject|\XApi\Repository\Doctrine\Repository\Mapping\StatementStorage
3131
*/
3232
private $mappedStatementRepository;
3333

@@ -119,12 +119,12 @@ public function testSaveWithoutFlush()
119119
}
120120

121121
/**
122-
* @return \PHPUnit_Framework_MockObject_MockObject|\XApi\Repository\Doctrine\Repository\Mapping\StatementRepository
122+
* @return \PHPUnit_Framework_MockObject_MockObject|\XApi\Repository\Doctrine\Repository\Mapping\StatementStorage
123123
*/
124124
protected function createMappedStatementRepositoryMock()
125125
{
126126
return $this
127-
->getMockBuilder('\XApi\Repository\Doctrine\Repository\Mapping\StatementRepository')
127+
->getMockBuilder('\XApi\Repository\Doctrine\Repository\Mapping\StatementStorage')
128128
->getMock();
129129
}
130130
}

0 commit comments

Comments
 (0)