diff --git a/composer.json b/composer.json index 0921039..f9e42c4 100644 --- a/composer.json +++ b/composer.json @@ -21,12 +21,11 @@ ], "require" : { "php" : ">=5.3", - "phpunit/phpunit" : "~4.8", - "phpunit/dbunit" : "~1.4", - "php-platform/mock-config" : "~0.1", - "php-platform/errors" : "~0.1" - }, - "require-dev" : { + "phpunit/phpunit" : "~4.8", + "phpunit/dbunit" : "~1.4", + "php-platform/mock-config" : "~0.1", + "php-platform/errors" : "~0.1", + "php-platform/session" : "~0.1" }, "autoload" : { "psr-4" : { diff --git a/composer.lock b/composer.lock index 65e53cc..3da5058 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "cb9000cd36895d26afb4831370a2fc23", + "content-hash": "6ba8bc8b103026bfa52afe8eb0b6051d", "packages": [ { "name": "doctrine/instantiator", @@ -62,16 +62,16 @@ }, { "name": "php-platform/config", - "version": "v0.1.2", + "version": "v0.1.4", "source": { "type": "git", "url": "https://github.com/PHPPlatform/config.git", - "reference": "df0d504d9a1c5d83cc596317ab7be7a99ba518fc" + "reference": "74a7f2e40411d94cdc6c48d2a7773965930964e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPPlatform/config/zipball/df0d504d9a1c5d83cc596317ab7be7a99ba518fc", - "reference": "df0d504d9a1c5d83cc596317ab7be7a99ba518fc", + "url": "https://api.github.com/repos/PHPPlatform/config/zipball/74a7f2e40411d94cdc6c48d2a7773965930964e0", + "reference": "74a7f2e40411d94cdc6c48d2a7773965930964e0", "shasum": "" }, "require": { @@ -102,20 +102,20 @@ "config", "php-platform" ], - "time": "2017-01-12T05:06:30+00:00" + "time": "2017-06-06T07:06:08+00:00" }, { "name": "php-platform/errors", - "version": "v0.1.1", + "version": "v0.1.3", "source": { "type": "git", "url": "https://github.com/PHPPlatform/errors.git", - "reference": "f07a7b9cf4a4363f213f27c12084d852ea6e0619" + "reference": "44e55463ef2ad61042be70e477323964f84fbb58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPPlatform/errors/zipball/f07a7b9cf4a4363f213f27c12084d852ea6e0619", - "reference": "f07a7b9cf4a4363f213f27c12084d852ea6e0619", + "url": "https://api.github.com/repos/PHPPlatform/errors/zipball/44e55463ef2ad61042be70e477323964f84fbb58", + "reference": "44e55463ef2ad61042be70e477323964f84fbb58", "shasum": "" }, "require": { @@ -148,20 +148,20 @@ "logging", "php-platform" ], - "time": "2017-01-09T08:10:48+00:00" + "time": "2017-02-06T04:49:29+00:00" }, { "name": "php-platform/json-cache", - "version": "v0.1.1", + "version": "v0.1.2", "source": { "type": "git", "url": "https://github.com/PHPPlatform/json-cache.git", - "reference": "0c6621fda8247c4720a74fbc9fdf42c4bb68cb1f" + "reference": "e9279ab977a16d586023c2b99d343f3d8c497d9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPPlatform/json-cache/zipball/0c6621fda8247c4720a74fbc9fdf42c4bb68cb1f", - "reference": "0c6621fda8247c4720a74fbc9fdf42c4bb68cb1f", + "url": "https://api.github.com/repos/PHPPlatform/json-cache/zipball/e9279ab977a16d586023c2b99d343f3d8c497d9a", + "reference": "e9279ab977a16d586023c2b99d343f3d8c497d9a", "shasum": "" }, "require": { @@ -193,7 +193,7 @@ "metadata", "php-platform" ], - "time": "2017-01-19T14:15:38+00:00" + "time": "2017-03-31T09:46:34+00:00" }, { "name": "php-platform/mock-config", @@ -240,6 +240,52 @@ ], "time": "2017-01-19T14:25:22+00:00" }, + { + "name": "php-platform/session", + "version": "v0.1.0", + "source": { + "type": "git", + "url": "https://github.com/PHPPlatform/session.git", + "reference": "7b4fafa12ccc4b67c161cb1d15166151e2291424" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPPlatform/session/zipball/7b4fafa12ccc4b67c161cb1d15166151e2291424", + "reference": "7b4fafa12ccc4b67c161cb1d15166151e2291424", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "php-platform/config": "~0.1", + "php-platform/errors": "~0.1" + }, + "require-dev": { + "php-platform/mock-config": "~0.1", + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpPlatform\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "authors": [ + { + "name": "Raghavendra K R", + "email": "krraghavendra@yahoo.co.in", + "homepage": "http://krraghavendra.in", + "role": "Software Developer" + } + ], + "homepage": "https://github.com/PHPPlatform/session", + "keywords": [ + "collaboration", + "php session", + "session" + ], + "time": "2017-03-29T17:05:05+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "1.0", @@ -388,27 +434,27 @@ }, { "name": "phpspec/prophecy", - "version": "v1.6.2", + "version": "v1.7.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0|^2.0" + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.0", + "phpspec/phpspec": "^2.5|^3.2", "phpunit/phpunit": "^4.8 || ^5.6.5" }, "type": "library", @@ -447,7 +493,7 @@ "spy", "stub" ], - "time": "2016-11-21T14:58:47+00:00" + "time": "2017-03-02T20:05:34+00:00" }, { "name": "phpunit/dbunit", @@ -660,25 +706,30 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.8", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4|~5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -700,20 +751,20 @@ "keywords": [ "timer" ], - "time": "2016-05-12T18:03:57+00:00" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.9", + "version": "1.4.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b" + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", "shasum": "" }, "require": { @@ -749,20 +800,20 @@ "keywords": [ "tokenizer" ], - "time": "2016-11-15T14:06:22+00:00" + "time": "2017-02-27T10:12:30+00:00" }, { "name": "phpunit/phpunit", - "version": "4.8.32", + "version": "4.8.35", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f5e1941a8dacf0d904753ff2895c6f68e54bcee1" + "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f5e1941a8dacf0d904753ff2895c6f68e54bcee1", - "reference": "f5e1941a8dacf0d904753ff2895c6f68e54bcee1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/791b1a67c25af50e230f841ee7a9c6eba507dc87", + "reference": "791b1a67c25af50e230f841ee7a9c6eba507dc87", "shasum": "" }, "require": { @@ -821,7 +872,7 @@ "testing", "xunit" ], - "time": "2017-01-22T08:37:05+00:00" + "time": "2017-02-06T05:18:07+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -881,16 +932,16 @@ }, { "name": "sebastian/comparator", - "version": "1.2.2", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/6a1ed12e8b2409076ab22e3897126211ff8b1f7f", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { @@ -941,27 +992,27 @@ "compare", "equality" ], - "time": "2016-11-19T09:18:40+00:00" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { @@ -993,7 +1044,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08T07:14:41+00:00" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", @@ -1165,16 +1216,16 @@ }, { "name": "sebastian/recursion-context", - "version": "1.0.2", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", "shasum": "" }, "require": { @@ -1214,7 +1265,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11T19:50:13+00:00" + "time": "2016-10-03T07:41:43+00:00" }, { "name": "sebastian/version", @@ -1253,16 +1304,16 @@ }, { "name": "symfony/yaml", - "version": "v3.2.2", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "50eadbd7926e31842893c957eca362b21592a97d" + "reference": "9752a30000a8ca9f4b34b5227d15d0101b96b063" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/50eadbd7926e31842893c957eca362b21592a97d", - "reference": "50eadbd7926e31842893c957eca362b21592a97d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/9752a30000a8ca9f4b34b5227d15d0101b96b063", + "reference": "9752a30000a8ca9f4b34b5227d15d0101b96b063", "shasum": "" }, "require": { @@ -1277,7 +1328,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -1304,7 +1355,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-01-03T13:51:32+00:00" + "time": "2017-06-02T22:05:06+00:00" }, { "name": "webmozart/assert", diff --git a/src/Tests/PersistUnit/ModelTest.php b/src/Tests/PersistUnit/ModelTest.php index 39cf958..a57ce8e 100644 --- a/src/Tests/PersistUnit/ModelTest.php +++ b/src/Tests/PersistUnit/ModelTest.php @@ -107,6 +107,8 @@ public static function setUpBeforeClass(){ MockSettings::setSettings('php-platform/persist', "mysql.outputDateFormat", "%Y-%m-%d"); MockSettings::setSettings('php-platform/persist', "mysql.outputTimeFormat", "%H:%i:%S"); MockSettings::setSettings('php-platform/persist', "mysql.outputDateTimeFormat", "%Y-%m-%d %H:%i:%S"); + + MockSettings::setSettings("php-platform/session", "session.class", 'PhpPlatform\Tests\PersistUnit\SessionImpl'); $logFile = getenv('sqlLogFile'); if($logFile){ diff --git a/src/Tests/PersistUnit/SessionImpl.php b/src/Tests/PersistUnit/SessionImpl.php new file mode 100644 index 0000000..545a5f3 --- /dev/null +++ b/src/Tests/PersistUnit/SessionImpl.php @@ -0,0 +1,63 @@ +id = md5(rand(0, 100).time().'SimpleSession for testing'.rand(100, 1000)); + $this->cacheFileName = $this->id; + parent::__construct(); + } + + public static function getInstance(){ + if(self::$instace == null){ + self::$instace = new SessionImpl(); + } + return self::$instace; + } + + public function set($key, $value){ + $keys = Reflection::invokeArgs(get_parent_class(), 'getPaths', $this, array($key)); + foreach (array_reverse($keys) as $_key){ + $value = array($_key=>$value); + } + return parent::setData($value); + } + + public function get($key) { + return parent::getData($key); + } + + public function clear(){ + return parent::reset(); + } + + + public function reset($flag=0){ + self::$instace = new SessionImpl(); + if($flag & Session::RESET_COPY_OLD){ + self::$instace->setData(self::getData('')); + } + if($flag & Session::RESET_DELETE_OLD){ + parent::reset(); + } + Reflection::setValue('PhpPlatform\Session\Factory', 'session', null, self::$instace); + return self::$instace; + } + + + public function getId(){ + return $this->id; + } + +} \ No newline at end of file