diff --git a/CHANGELOG.md b/CHANGELOG.md index 36db407..409c9e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ CHANGELOG 0.4.0 ----- +* renamed the `StatementRepository` interface to `StatementStorage` and moved + it to the `XApi\Repository\Doctrine\Storage` namespace * made the package compatible with `3.x` releases of `ramsey/uuid` * allow `2.x` releases of the `php-xapi/model` package too diff --git a/src/Repository/StatementRepository.php b/src/Repository/StatementRepository.php index edba99f..82f2f04 100644 --- a/src/Repository/StatementRepository.php +++ b/src/Repository/StatementRepository.php @@ -20,7 +20,7 @@ use Xabbuh\XApi\Model\Uuid as ModelUuid; use XApi\Repository\Api\StatementRepositoryInterface; use XApi\Repository\Doctrine\Mapping\Statement as MappedStatement; -use XApi\Repository\Doctrine\Repository\Mapping\StatementRepository as MappedStatementRepository; +use XApi\Repository\Doctrine\Storage\StatementStorage; /** * Doctrine based {@link Statement} repository. @@ -31,7 +31,7 @@ final class StatementRepository implements StatementRepositoryInterface { private $repository; - public function __construct(MappedStatementRepository $repository) + public function __construct(StatementStorage $repository) { $this->repository = $repository; } diff --git a/src/Repository/Mapping/StatementRepository.php b/src/Storage/StatementStorage.php similarity index 93% rename from src/Repository/Mapping/StatementRepository.php rename to src/Storage/StatementStorage.php index 7999cc0..ce13c7b 100644 --- a/src/Repository/Mapping/StatementRepository.php +++ b/src/Storage/StatementStorage.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace XApi\Repository\Doctrine\Repository\Mapping; +namespace XApi\Repository\Doctrine\Storage; use XApi\Repository\Doctrine\Mapping\Statement; @@ -18,7 +18,7 @@ * * @author Christian Flothmann */ -interface StatementRepository +interface StatementStorage { /** * @param array $criteria diff --git a/src/Test/Functional/StatementRepositoryTest.php b/src/Test/Functional/StatementRepositoryTest.php index 6e92ea3..49d80a2 100644 --- a/src/Test/Functional/StatementRepositoryTest.php +++ b/src/Test/Functional/StatementRepositoryTest.php @@ -13,8 +13,8 @@ use Doctrine\Common\Persistence\ObjectManager; use XApi\Repository\Api\Test\Functional\StatementRepositoryTest as BaseStatementRepositoryTest; -use XApi\Repository\Doctrine\Repository\Mapping\StatementRepository as MappedStatementRepository; use XApi\Repository\Doctrine\Repository\StatementRepository; +use XApi\Repository\Doctrine\Storage\StatementStorage; use XApi\Repository\Doctrine\Test\StatementRepository as FreshStatementRepository; /** @@ -28,26 +28,26 @@ abstract class StatementRepositoryTest extends BaseStatementRepositoryTest protected $objectManager; /** - * @var MappedStatementRepository + * @var StatementStorage */ - protected $repository; + protected $storage; protected function setUp() { $this->objectManager = $this->createObjectManager(); - $this->repository = $this->createRepository(); + $this->storage = $this->createStorage(); parent::setUp(); } protected function createStatementRepository() { - return new FreshStatementRepository(new StatementRepository($this->repository), $this->objectManager); + return new FreshStatementRepository(new StatementRepository($this->storage), $this->objectManager); } protected function cleanDatabase() { - foreach ($this->repository->findStatements(array()) as $statement) { + foreach ($this->storage->findStatements(array()) as $statement) { $this->objectManager->remove($statement); } @@ -64,7 +64,7 @@ abstract protected function createObjectManager(); */ abstract protected function getStatementClassName(); - private function createRepository() + private function createStorage() { return $this->objectManager->getRepository($this->getStatementClassName()); } diff --git a/src/Test/Unit/Repository/Mapping/StatementRepositoryTest.php b/src/Test/Unit/Storage/StatementStorageTest.php similarity index 79% rename from src/Test/Unit/Repository/Mapping/StatementRepositoryTest.php rename to src/Test/Unit/Storage/StatementStorageTest.php index 3641229..162e764 100644 --- a/src/Test/Unit/Repository/Mapping/StatementRepositoryTest.php +++ b/src/Test/Unit/Storage/StatementStorageTest.php @@ -9,17 +9,17 @@ * file that was distributed with this source code. */ -namespace XApi\Repository\Doctrine\Test\Unit\Repository\Mapping; +namespace XApi\Repository\Doctrine\Test\Unit\Storage; use PHPUnit\Framework\TestCase; use Xabbuh\XApi\DataFixtures\StatementFixtures; use XApi\Repository\Doctrine\Mapping\Statement; -use XApi\Repository\Doctrine\Repository\Mapping\StatementRepository; +use XApi\Repository\Doctrine\Storage\StatementStorage; /** * @author Christian Flothmann */ -abstract class StatementRepositoryTest extends TestCase +abstract class StatementStorageTest extends TestCase { /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -37,16 +37,16 @@ abstract class StatementRepositoryTest extends TestCase private $classMetadata; /** - * @var StatementRepository + * @var StatementStorage */ - private $repository; + private $storage; protected function setUp() { $this->objectManager = $this->createObjectManagerMock(); $this->unitOfWork = $this->createUnitOfWorkMock(); $this->classMetadata = $this->createClassMetadataMock(); - $this->repository = $this->createMappedStatementRepository($this->objectManager, $this->unitOfWork, $this->classMetadata); + $this->storage = $this->createStatementStorage($this->objectManager, $this->unitOfWork, $this->classMetadata); } public function testStatementDocumentIsPersisted() @@ -59,7 +59,7 @@ public function testStatementDocumentIsPersisted() ; $mappedStatement = Statement::fromModel(StatementFixtures::getMinimalStatement()); - $this->repository->storeStatement($mappedStatement, true); + $this->storage->storeStatement($mappedStatement, true); } public function testFlushIsCalledByDefault() @@ -71,7 +71,7 @@ public function testFlushIsCalledByDefault() ; $mappedStatement = Statement::fromModel(StatementFixtures::getMinimalStatement()); - $this->repository->storeStatement($mappedStatement); + $this->storage->storeStatement($mappedStatement); } public function testCallToFlushCanBeSuppressed() @@ -83,7 +83,7 @@ public function testCallToFlushCanBeSuppressed() ; $mappedStatement = Statement::fromModel(StatementFixtures::getMinimalStatement()); - $this->repository->storeStatement($mappedStatement, false); + $this->storage->storeStatement($mappedStatement, false); } abstract protected function getObjectManagerClass(); @@ -116,5 +116,5 @@ protected function createClassMetadataMock() ->getMock(); } - abstract protected function createMappedStatementRepository($objectManager, $unitOfWork, $classMetadata); + abstract protected function createStatementStorage($objectManager, $unitOfWork, $classMetadata); } diff --git a/tests/Unit/Repository/StatementRepositoryTest.php b/tests/Unit/Repository/StatementRepositoryTest.php index 9e8a599..16411d6 100644 --- a/tests/Unit/Repository/StatementRepositoryTest.php +++ b/tests/Unit/Repository/StatementRepositoryTest.php @@ -20,6 +20,7 @@ use Xabbuh\XApi\Model\Uuid as ModelUuid; use XApi\Repository\Doctrine\Mapping\Statement as MappedStatement; use XApi\Repository\Doctrine\Repository\StatementRepository; +use XApi\Repository\Doctrine\Storage\StatementStorage; /** * @author Christian Flothmann @@ -27,7 +28,7 @@ class StatementRepositoryTest extends TestCase { /** - * @var \PHPUnit_Framework_MockObject_MockObject|\XApi\Repository\Doctrine\Repository\Mapping\StatementRepository + * @var \PHPUnit_Framework_MockObject_MockObject|StatementStorage */ private $mappedStatementRepository; @@ -119,12 +120,12 @@ public function testSaveWithoutFlush() } /** - * @return \PHPUnit_Framework_MockObject_MockObject|\XApi\Repository\Doctrine\Repository\Mapping\StatementRepository + * @return \PHPUnit_Framework_MockObject_MockObject|StatementStorage */ protected function createMappedStatementRepositoryMock() { return $this - ->getMockBuilder('\XApi\Repository\Doctrine\Repository\Mapping\StatementRepository') + ->getMockBuilder('\XApi\Repository\Doctrine\Storage\StatementStorage') ->getMock(); } }