From c38e235f03164de6bd661517c7e7738757bbe1e8 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 14 Sep 2016 17:07:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../library/think/cache/driver/cacheTestCase.php | 12 ++++++++++++ tests/thinkphp/library/think/sessionTest.php | 10 +++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/thinkphp/library/think/cache/driver/cacheTestCase.php b/tests/thinkphp/library/think/cache/driver/cacheTestCase.php index 3039024d..ec8f9b6b 100644 --- a/tests/thinkphp/library/think/cache/driver/cacheTestCase.php +++ b/tests/thinkphp/library/think/cache/driver/cacheTestCase.php @@ -166,6 +166,18 @@ abstract class cacheTestCase extends \PHPUnit_Framework_TestCase $this->assertFalse($cache->get('number_test')); } + /** + * 获取并删除缓存测试 + * @return mixed + * @access public + */ + public function testPull() + { + $cache = $this->prepare(); + $this->assertEquals(11, $cache->pull('number_test')); + $this->assertFalse($cache->get('number_test')); + } + /** * 清空缓存测试 * @return mixed diff --git a/tests/thinkphp/library/think/sessionTest.php b/tests/thinkphp/library/think/sessionTest.php index 76c18ef0..ab3e64f4 100644 --- a/tests/thinkphp/library/think/sessionTest.php +++ b/tests/thinkphp/library/think/sessionTest.php @@ -124,7 +124,7 @@ class sessionTest extends \PHPUnit_Framework_TestCase // session_status() if (strstr(PHP_VERSION, 'hhvm')) { $this->assertEquals('', ini_get('session.auto_start')); - }else{ + } else { $this->assertEquals(0, ini_get('session.auto_start')); } @@ -213,6 +213,14 @@ class sessionTest extends \PHPUnit_Framework_TestCase $this->assertEquals(Session::get('sessionnamegetarrper.subname', 'think_'), $_SESSION['think_']['sessionnamegetarrper']['subname']); } + public function testPull() + { + Session::prefix(null); + Session::set('sessionnamedel', 'sessionvalue'); + $this->assertEquals('sessionvalue', Session::pull('sessionnameget')); + $this->assertNull(Session::get('sessionnameget')); + } + /** * @covers think\Session::delete *