Skip to content

Commit

Permalink
单元测试完善
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Sep 14, 2016
1 parent e37f5ae commit c38e235
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tests/thinkphp/library/think/cache/driver/cacheTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,18 @@ public function testDelete()
$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
Expand Down
10 changes: 9 additions & 1 deletion tests/thinkphp/library/think/sessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function testInit()
// session_status()
if (strstr(PHP_VERSION, 'hhvm')) {
$this->assertEquals('', ini_get('session.auto_start'));
}else{
} else {
$this->assertEquals(0, ini_get('session.auto_start'));
}

Expand Down Expand Up @@ -213,6 +213,14 @@ public function testGet()
$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
*
Expand Down

0 comments on commit c38e235

Please sign in to comment.