From cf9542ebb1876b8049f646afe1864ffb33eb5a10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kucha=C5=99?= <honza.kuchar@grifart.cz> Date: Sat, 21 May 2016 13:03:15 +0200 Subject: [PATCH] project moved from Mappi\Store to Mappi\Cursor --- .idea/.name | 2 +- .idea/{store.iml => cursor.iml} | 0 .idea/modules.xml | 2 +- .idea/vcs.xml | 6 ------ composer.json | 6 +++--- src/{PostgresDriver => }/ArrayCursorDriver.php | 6 +++--- src/{PostgresDriver => }/Cursor.php | 6 +++--- src/{PostgresDriver => }/CursorException.php | 4 ++-- src/{PostgresDriver => }/CursorPosition.php | 6 +++--- .../CursorPositionOrigin.php | 4 ++-- src/{PostgresDriver => }/ICursor.php | 6 +++--- src/{PostgresDriver => }/ICursorDriver.php | 6 +++--- src/IDataStore.php | 14 -------------- src/IRecord.php | 13 ------------- .../PostgresCursorDriver.php | 4 ++-- .../PostgresCursorFactory.php | 4 ++-- src/{PostgresDriver => }/SemanticCursor.php | 6 +++--- src/{PostgresDriver => }/TrackedCursor.php | 6 ++---- .../PostgresDriver => Cursor}/CursorTest.phpt | 11 +++++------ .../PostgresDriver => Cursor}/ICursorTest.php | 6 +++--- .../PostgresCursorTest.phpt | 8 ++++---- .../SemanticCursorIntegration.phpt | 13 ++++++------- .../SemanticCursorTest.phpt | 12 ++++++------ .../TrackedCursorTest.phpt | 17 +++++++---------- 24 files changed, 64 insertions(+), 104 deletions(-) rename .idea/{store.iml => cursor.iml} (100%) delete mode 100644 .idea/vcs.xml rename src/{PostgresDriver => }/ArrayCursorDriver.php (96%) rename src/{PostgresDriver => }/Cursor.php (94%) rename src/{PostgresDriver => }/CursorException.php (97%) rename src/{PostgresDriver => }/CursorPosition.php (94%) rename src/{PostgresDriver => }/CursorPositionOrigin.php (64%) rename src/{PostgresDriver => }/ICursor.php (94%) rename src/{PostgresDriver => }/ICursorDriver.php (94%) delete mode 100644 src/IDataStore.php delete mode 100644 src/IRecord.php rename src/{PostgresDriver => }/PostgresCursorDriver.php (96%) rename src/{PostgresDriver => }/PostgresCursorFactory.php (92%) rename src/{PostgresDriver => }/SemanticCursor.php (97%) rename src/{PostgresDriver => }/TrackedCursor.php (97%) rename tests/{Store/PostgresDriver => Cursor}/CursorTest.phpt (68%) rename tests/{Store/PostgresDriver => Cursor}/ICursorTest.php (98%) rename tests/{Store/PostgresDriver => Cursor}/PostgresCursorTest.phpt (78%) rename tests/{Store/PostgresDriver => Cursor}/SemanticCursorIntegration.phpt (66%) rename tests/{Store/PostgresDriver => Cursor}/SemanticCursorTest.phpt (93%) rename tests/{Store/PostgresDriver => Cursor}/TrackedCursorTest.phpt (94%) diff --git a/.idea/.name b/.idea/.name index bed0165..b7796e0 100644 --- a/.idea/.name +++ b/.idea/.name @@ -1 +1 @@ -mappi/store \ No newline at end of file +cursor \ No newline at end of file diff --git a/.idea/store.iml b/.idea/cursor.iml similarity index 100% rename from .idea/store.iml rename to .idea/cursor.iml diff --git a/.idea/modules.xml b/.idea/modules.xml index bfe35da..5b8593b 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ <project version="4"> <component name="ProjectModuleManager"> <modules> - <module fileurl="file://$PROJECT_DIR$/.idea/store.iml" filepath="$PROJECT_DIR$/.idea/store.iml" /> + <module fileurl="file://$PROJECT_DIR$/../cursor/.idea/cursor.iml" filepath="$PROJECT_DIR$/../cursor/.idea/cursor.iml" /> </modules> </component> </project> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project version="4"> - <component name="VcsDirectoryMappings"> - <mapping directory="$PROJECT_DIR$" vcs="Git" /> - </component> -</project> \ No newline at end of file diff --git a/composer.json b/composer.json index c23206a..7f302cd 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "mappi/store", + "name": "mappi/cursor", "require": { "php": ">=7.0.0", "dibi/dibi": "^3.0", @@ -18,13 +18,13 @@ ], "autoload": { "psr-4": { - "Grifart\\Mappi\\Store\\": "src/" + "Grifart\\Mappi\\Cursor\\": "src/" } }, "autoload-dev": { "psr-4": { - "Grifart\\Mappi\\Tests\\Store\\": "tests/Store/" + "Grifart\\Mappi\\Tests\\Cursor\\": "tests/Cursor/" } } } diff --git a/src/PostgresDriver/ArrayCursorDriver.php b/src/ArrayCursorDriver.php similarity index 96% rename from src/PostgresDriver/ArrayCursorDriver.php rename to src/ArrayCursorDriver.php index b276051..f982f03 100644 --- a/src/PostgresDriver/ArrayCursorDriver.php +++ b/src/ArrayCursorDriver.php @@ -1,16 +1,16 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; /** * Array Cursor simulates scrolling cursor as implemented in PostgreSQL 9.5. * * For more information see ICursor. * @see ICursor - * @package Grifart\Mappi\Store\PostgresDriver + * @package Grifart\Mappi\Cursor */ class ArrayCursorDriver implements ICursorDriver { diff --git a/src/PostgresDriver/Cursor.php b/src/Cursor.php similarity index 94% rename from src/PostgresDriver/Cursor.php rename to src/Cursor.php index 5d849c8..70b1bbc 100644 --- a/src/PostgresDriver/Cursor.php +++ b/src/Cursor.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; /** * PostgreSQL cursor driver @@ -13,7 +13,7 @@ namespace Grifart\Mappi\Store\PostgresDriver; * simply get no more values. You can check if you reached the end by * `isHeadOnRecord()`. * - * @package Grifart\Mappi\Store\PostgresDriver + * @package Grifart\Mappi\Cursor */ final class Cursor implements ICursor { diff --git a/src/PostgresDriver/CursorException.php b/src/CursorException.php similarity index 97% rename from src/PostgresDriver/CursorException.php rename to src/CursorException.php index dfd0ec1..05bccc5 100644 --- a/src/PostgresDriver/CursorException.php +++ b/src/CursorException.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; use Exception; diff --git a/src/PostgresDriver/CursorPosition.php b/src/CursorPosition.php similarity index 94% rename from src/PostgresDriver/CursorPosition.php rename to src/CursorPosition.php index f682c48..19383d6 100644 --- a/src/PostgresDriver/CursorPosition.php +++ b/src/CursorPosition.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; // todo: make this immutable as VOs should be @@ -11,7 +11,7 @@ namespace Grifart\Mappi\Store\PostgresDriver; * Value object for TrackedCursor position * * @link https://github.com/nicolopignatelli/valueobjects (inspiration) - * @package Grifart\Mappi\Store\PostgresDriver + * @package Grifart\Mappi\Cursor */ final class CursorPosition { diff --git a/src/PostgresDriver/CursorPositionOrigin.php b/src/CursorPositionOrigin.php similarity index 64% rename from src/PostgresDriver/CursorPositionOrigin.php rename to src/CursorPositionOrigin.php index 01447b8..41dabea 100644 --- a/src/PostgresDriver/CursorPositionOrigin.php +++ b/src/CursorPositionOrigin.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; use MabeEnum\Enum; diff --git a/src/PostgresDriver/ICursor.php b/src/ICursor.php similarity index 94% rename from src/PostgresDriver/ICursor.php rename to src/ICursor.php index 6c11a89..67ae8f5 100644 --- a/src/PostgresDriver/ICursor.php +++ b/src/ICursor.php @@ -1,8 +1,8 @@ <?php /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; /** * Represents cursor @@ -23,7 +23,7 @@ namespace Grifart\Mappi\Store\PostgresDriver; * @link http://www.postgresql.org/docs/9.5/static/plpgsql-cursors.html * @link http://www.postgresql.org/docs/8.1/static/sql-fetch.html * @link http://www.postgresql.org/docs/8.1/static/sql-move.html - * @package Grifart\Mappi\Store\PostgresDriver + * @package Grifart\Mappi\Cursor */ interface ICursor { diff --git a/src/PostgresDriver/ICursorDriver.php b/src/ICursorDriver.php similarity index 94% rename from src/PostgresDriver/ICursorDriver.php rename to src/ICursorDriver.php index 6e645a9..e4b0d97 100644 --- a/src/PostgresDriver/ICursorDriver.php +++ b/src/ICursorDriver.php @@ -1,8 +1,8 @@ <?php /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; /** * Represents cursor @@ -20,7 +20,7 @@ namespace Grifart\Mappi\Store\PostgresDriver; * - Cursor starts at BEGINNING * - When you move too far HEAD will be parked in BEGINNING position or in the END position * - * @package Grifart\Mappi\Store\PostgresDriver + * @package Grifart\Mappi\Cursor */ interface ICursorDriver { diff --git a/src/IDataStore.php b/src/IDataStore.php deleted file mode 100644 index 7b9fe99..0000000 --- a/src/IDataStore.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php declare(strict_types = 1); - -namespace Grifart\Mappi\Store; - -/** - * Data source - */ -interface IDataStore extends \ArrayAccess, \Countable, \Traversable -{ - public function getAt(int $index) : IRecord; - public function getRange(int $firstIndex, int $numberOfRows); - - -} \ No newline at end of file diff --git a/src/IRecord.php b/src/IRecord.php deleted file mode 100644 index 72bf684..0000000 --- a/src/IRecord.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php declare(strict_types = 1); - -namespace Grifart\Mappi\Store; - -/** - * Read only record of data source - */ -interface IRecord -{ - - public function get($name); - -} \ No newline at end of file diff --git a/src/PostgresDriver/PostgresCursorDriver.php b/src/PostgresCursorDriver.php similarity index 96% rename from src/PostgresDriver/PostgresCursorDriver.php rename to src/PostgresCursorDriver.php index 5413c48..6d58bdf 100644 --- a/src/PostgresDriver/PostgresCursorDriver.php +++ b/src/PostgresCursorDriver.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; use Dibi\Connection; use Dibi\Row; diff --git a/src/PostgresDriver/PostgresCursorFactory.php b/src/PostgresCursorFactory.php similarity index 92% rename from src/PostgresDriver/PostgresCursorFactory.php rename to src/PostgresCursorFactory.php index b7a1c7c..67b08d8 100644 --- a/src/PostgresDriver/PostgresCursorFactory.php +++ b/src/PostgresCursorFactory.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; use Dibi\Connection; diff --git a/src/PostgresDriver/SemanticCursor.php b/src/SemanticCursor.php similarity index 97% rename from src/PostgresDriver/SemanticCursor.php rename to src/SemanticCursor.php index 9fafb78..2c618e1 100644 --- a/src/PostgresDriver/SemanticCursor.php +++ b/src/SemanticCursor.php @@ -1,9 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; +namespace Grifart\Mappi\Cursor; /** * Adds semantic API into ICursor. @@ -14,7 +14,7 @@ namespace Grifart\Mappi\Store\PostgresDriver; * - LAST: the last row position * - END: the position after last row (end position) * - * @package Grifart\Mappi\Store\PostgresDriver + * @package Grifart\Mappi\Cursor */ class SemanticCursor implements ICursor { diff --git a/src/PostgresDriver/TrackedCursor.php b/src/TrackedCursor.php similarity index 97% rename from src/PostgresDriver/TrackedCursor.php rename to src/TrackedCursor.php index d086671..b4ddd27 100644 --- a/src/PostgresDriver/TrackedCursor.php +++ b/src/TrackedCursor.php @@ -1,11 +1,9 @@ <?php declare(strict_types = 1); /** - * This file is part of mappi/store. + * This file is part of mappi/cursor. */ -namespace Grifart\Mappi\Store\PostgresDriver; - -use Dibi\Connection; +namespace Grifart\Mappi\Cursor; class TrackedCursor implements ICursor { diff --git a/tests/Store/PostgresDriver/CursorTest.phpt b/tests/Cursor/CursorTest.phpt similarity index 68% rename from tests/Store/PostgresDriver/CursorTest.phpt rename to tests/Cursor/CursorTest.phpt index 2a1b9f1..2473cb4 100644 --- a/tests/Store/PostgresDriver/CursorTest.phpt +++ b/tests/Cursor/CursorTest.phpt @@ -3,14 +3,13 @@ * @testCase */ -namespace Grifart\Mappi\Tests\Store\Store\PostgresDriver; +namespace Grifart\Mappi\Tests\Store\Cursor; -use Grifart\Mappi\Store\PostgresDriver\ArrayCursorDriver; -use Grifart\Mappi\Store\PostgresDriver\Cursor; -use Grifart\Mappi\Store\PostgresDriver\PostgresCursorFactory; -use Grifart\Mappi\Store\PostgresDriver\ICursor; +use Grifart\Mappi\Cursor\ArrayCursorDriver; +use Grifart\Mappi\Cursor\Cursor; +use Grifart\Mappi\Cursor\ICursor; -require_once __DIR__ . "/../../bootstrap.php"; +require_once __DIR__ . "/../bootstrap.php"; require_once __DIR__ . "/ICursorTest.php"; class CursorTest extends ICursorTest diff --git a/tests/Store/PostgresDriver/ICursorTest.php b/tests/Cursor/ICursorTest.php similarity index 98% rename from tests/Store/PostgresDriver/ICursorTest.php rename to tests/Cursor/ICursorTest.php index 7c4923e..5c45a82 100644 --- a/tests/Store/PostgresDriver/ICursorTest.php +++ b/tests/Cursor/ICursorTest.php @@ -3,9 +3,9 @@ * @testCase */ -namespace Grifart\Mappi\Tests\Store\Store\PostgresDriver; +namespace Grifart\Mappi\Tests\Store\Cursor; -use Grifart\Mappi\Store\PostgresDriver\ICursor; +use Grifart\Mappi\Cursor\ICursor; use Grifart\Mappi\Tests\Store\BaseTest; use Tester\Assert; @@ -15,7 +15,7 @@ use Tester\Assert; * This file is using Given-When-Then naming convention. * @link http://martinfowler.com/bliki/GivenWhenThen.html * - * @package Grifart\Mappi\Tests\Store\Store\PostgresDriver + * @package Grifart\Mappi\Tests\Store\Cursor */ abstract class ICursorTest extends BaseTest { diff --git a/tests/Store/PostgresDriver/PostgresCursorTest.phpt b/tests/Cursor/PostgresCursorTest.phpt similarity index 78% rename from tests/Store/PostgresDriver/PostgresCursorTest.phpt rename to tests/Cursor/PostgresCursorTest.phpt index 851939f..716babd 100644 --- a/tests/Store/PostgresDriver/PostgresCursorTest.phpt +++ b/tests/Cursor/PostgresCursorTest.phpt @@ -3,14 +3,14 @@ * @testCase */ -namespace Grifart\Mappi\Tests\Store\Store\PostgresDriver; +namespace Grifart\Mappi\Tests\Store\Cursor; use Dibi\DriverException; -use Grifart\Mappi\Store\PostgresDriver\PostgresCursorFactory; -use Grifart\Mappi\Store\PostgresDriver\ICursor; +use Grifart\Mappi\Cursor\ICursor; +use Grifart\Mappi\Cursor\PostgresCursorFactory; use Tester\Environment; -require_once __DIR__ . "/../../bootstrap.php"; +require_once __DIR__ . "/../bootstrap.php"; require_once __DIR__ . "/ICursorTest.php"; class PostgresCursorTest extends ICursorTest diff --git a/tests/Store/PostgresDriver/SemanticCursorIntegration.phpt b/tests/Cursor/SemanticCursorIntegration.phpt similarity index 66% rename from tests/Store/PostgresDriver/SemanticCursorIntegration.phpt rename to tests/Cursor/SemanticCursorIntegration.phpt index 690877e..5cef2c7 100644 --- a/tests/Store/PostgresDriver/SemanticCursorIntegration.phpt +++ b/tests/Cursor/SemanticCursorIntegration.phpt @@ -3,22 +3,21 @@ * @testCase */ -namespace Grifart\Mappi\Tests\Store\Store\PostgresDriver; +namespace Grifart\Mappi\Tests\Store\Cursor; -use Grifart\Mappi\Store\PostgresDriver\ArrayCursorDriver; -use Grifart\Mappi\Store\PostgresDriver\Cursor; -use Grifart\Mappi\Store\PostgresDriver\PostgresCursorFactory; -use Grifart\Mappi\Store\PostgresDriver\SemanticCursor; +use Grifart\Mappi\Cursor\ArrayCursorDriver; +use Grifart\Mappi\Cursor\Cursor; +use Grifart\Mappi\Cursor\SemanticCursor; use Mockery; -require_once __DIR__ . "/../../bootstrap.php"; +require_once __DIR__ . "/../bootstrap.php"; require_once __DIR__ . "/ICursorTest.php"; /** * Behavioral test for SemanticCursor using mocking. * @link http://docs.mockery.io/en/latest/ * - * @package Grifart\Mappi\Tests\Store\Store\PostgresDriver + * @package Grifart\Mappi\Tests\Store\Cursor */ class SemanticCursorIntegrationTest extends ICursorTest { diff --git a/tests/Store/PostgresDriver/SemanticCursorTest.phpt b/tests/Cursor/SemanticCursorTest.phpt similarity index 93% rename from tests/Store/PostgresDriver/SemanticCursorTest.phpt rename to tests/Cursor/SemanticCursorTest.phpt index 087ec1e..329f7ed 100644 --- a/tests/Store/PostgresDriver/SemanticCursorTest.phpt +++ b/tests/Cursor/SemanticCursorTest.phpt @@ -3,23 +3,23 @@ * @testCase */ -namespace Grifart\Mappi\Tests\Store\Store\PostgresDriver; +namespace Grifart\Mappi\Tests\Store\Cursor; -use Grifart\Mappi\Store\PostgresDriver\CursorException; -use Grifart\Mappi\Store\PostgresDriver\ICursor; -use Grifart\Mappi\Store\PostgresDriver\SemanticCursor; +use Grifart\Mappi\Cursor\CursorException; +use Grifart\Mappi\Cursor\ICursor; +use Grifart\Mappi\Cursor\SemanticCursor; use Grifart\Mappi\Tests\Store\BaseTest; use Mockery; use Tester\Assert; -require_once __DIR__ . "/../../bootstrap.php"; +require_once __DIR__ . "/../bootstrap.php"; require_once __DIR__ . "/ICursorTest.php"; /** * Behavioral test for SemanticCursor using mocking. * @link http://docs.mockery.io/en/latest/ * - * @package Grifart\Mappi\Tests\Store\Store\PostgresDriver + * @package Grifart\Mappi\Tests\Store\Cursor */ class SemanticCursorTest extends BaseTest { diff --git a/tests/Store/PostgresDriver/TrackedCursorTest.phpt b/tests/Cursor/TrackedCursorTest.phpt similarity index 94% rename from tests/Store/PostgresDriver/TrackedCursorTest.phpt rename to tests/Cursor/TrackedCursorTest.phpt index d9b8d04..0511173 100644 --- a/tests/Store/PostgresDriver/TrackedCursorTest.phpt +++ b/tests/Cursor/TrackedCursorTest.phpt @@ -6,18 +6,15 @@ // TODO: moveBy() ->isOnRecord() ->moveBy() ->isOnRecord() (now I see state before and after command) // TODO: Maybe construct Cursor class in TrackedCursor constructor? -namespace Grifart\Mappi\Tests\Store\Store\PostgresDriver; - -use Grifart\Mappi\Store\PostgresDriver\ArrayCursorDriver; -use Grifart\Mappi\Store\PostgresDriver\Cursor; -use Grifart\Mappi\Store\PostgresDriver\PostgresCursorFactory; -use Grifart\Mappi\Store\PostgresDriver\CursorPosition; -use Grifart\Mappi\Store\PostgresDriver\ICursor; -use Grifart\Mappi\Store\PostgresDriver\TrackedCursor; -use Grifart\Mappi\Tests\Store\BaseTest; +namespace Grifart\Mappi\Tests\Store\Cursor; + +use Grifart\Mappi\Cursor\ArrayCursorDriver; +use Grifart\Mappi\Cursor\Cursor; +use Grifart\Mappi\Cursor\CursorPosition; +use Grifart\Mappi\Cursor\TrackedCursor; use Tester\Assert; -require_once __DIR__ . "/../../bootstrap.php"; +require_once __DIR__ . "/../bootstrap.php"; require_once __DIR__ . "/ICursorTest.php"; class TrackedCursorTest extends ICursorTest -- GitLab