Skip to content

Commit

Permalink
Fix incorrect test cases.
Browse files Browse the repository at this point in the history
Skip test for the clear() method, as no idea to test from CLI.
At this time, testIncrement and testDecrement would fail due to a bug in
commit 1200f86.
  • Loading branch information
chinpei215 committed Mar 13, 2016
1 parent 8a5b3bc commit 6105714
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/TestCase/Cache/Engine/XcacheEngineTest.php
Expand Up @@ -82,6 +82,7 @@ public function testConfig()
'prefix' => 'cake_',
'duration' => 3600,
'probability' => 100,
'groups' => [],
];
$this->assertTrue(isset($config['PHP_AUTH_USER']));
$this->assertTrue(isset($config['PHP_AUTH_PW']));
Expand Down Expand Up @@ -164,14 +165,17 @@ public function testDeleteCache()
*/
public function testClearCache()
{
if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg')) {
$this->markTestSkipped('Xcache administration functions are not available for the CLI.');
}
$data = 'this is a test of the emergency broadcasting system';
$result = Cache::write('clear_test_1', $data, 'xcache');
$this->assertTrue($result);

$result = Cache::write('clear_test_2', $data, 'xcache');
$this->assertTrue($result);

$result = Cache::clear();
$result = Cache::clear(false, 'xcache');
$this->assertTrue($result);
}

Expand All @@ -185,7 +189,7 @@ public function testDecrement()
$result = Cache::write('test_decrement', 5, 'xcache');
$this->assertTrue($result);

$result = Cache::decrement('test_decrement', 'xcache');
$result = Cache::decrement('test_decrement', 1, 'xcache');
$this->assertEquals(4, $result);

$result = Cache::read('test_decrement', 'xcache');
Expand All @@ -208,7 +212,7 @@ public function testIncrement()
$result = Cache::write('test_increment', 5, 'xcache');
$this->assertTrue($result);

$result = Cache::increment('test_increment', 'xcache');
$result = Cache::increment('test_increment', 1, 'xcache');
$this->assertEquals(6, $result);

$result = Cache::read('test_increment', 'xcache');
Expand Down

0 comments on commit 6105714

Please sign in to comment.