diff options
| author | Andreas Fischer <bantu@phpbb.com> | 2012-12-03 17:17:50 +0100 |
|---|---|---|
| committer | Andreas Fischer <bantu@phpbb.com> | 2012-12-03 17:17:50 +0100 |
| commit | 49f29259003da180c008a6bb6e0d5605c3a79bd9 (patch) | |
| tree | 13e7ff812d8efec5bec854c1e44d1006dcf50e1c /tests/cache/common_test_case.php | |
| parent | 34018ed1d63942ff96828d298c10895db1623c9a (diff) | |
| parent | db6b11a3902c27b612d7d6d4696c4cd8cf1f0bdf (diff) | |
| download | forums-49f29259003da180c008a6bb6e0d5605c3a79bd9.tar forums-49f29259003da180c008a6bb6e0d5605c3a79bd9.tar.gz forums-49f29259003da180c008a6bb6e0d5605c3a79bd9.tar.bz2 forums-49f29259003da180c008a6bb6e0d5605c3a79bd9.tar.xz forums-49f29259003da180c008a6bb6e0d5605c3a79bd9.zip | |
Merge remote-tracking branch 'p/ticket/9983' into develop
* p/ticket/9983:
[ticket/9983] Also check generic APC enable/disable.
[ticket/9983] Use APC instead of apc in error messages.
[ticket/9983] Skip tests if APC is not enabled for CLI.
[ticket/9983] Test for apc cache driver.
[ticket/9983] Add phpbb prefix to global variables.
[ticket/9983] Empty line by request.
[ticket/9983] Indeed, it is <?php.
[ticket/9983] Add a test for destroy.
[ticket/9983] Exercise exists also.
[ticket/9983] Add a purge test.
[ticket/9983] Rename test methods.
[ticket/9983] get/put cache test moved to a base class.
[ticket/9983] Create driver in setup in null driver test.
[ticket/9983] Split cache test into per-driver files.
[ticket/9983] Add redis cache driver tests.
Diffstat (limited to 'tests/cache/common_test_case.php')
| -rw-r--r-- | tests/cache/common_test_case.php | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/cache/common_test_case.php b/tests/cache/common_test_case.php new file mode 100644 index 0000000000..45cf80e424 --- /dev/null +++ b/tests/cache/common_test_case.php @@ -0,0 +1,64 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +abstract class phpbb_cache_common_test_case extends phpbb_database_test_case +{ + public function test_get_put_exists() + { + $this->assertFalse($this->driver->_exists('test_key')); + $this->assertSame(false, $this->driver->get('test_key')); + + $this->driver->put('test_key', 'test_value'); + + $this->assertTrue($this->driver->_exists('test_key')); + $this->assertEquals( + 'test_value', + $this->driver->get('test_key'), + 'File ACM put and get' + ); + } + + public function test_purge() + { + $this->driver->put('test_key', 'test_value'); + + $this->assertEquals( + 'test_value', + $this->driver->get('test_key'), + 'File ACM put and get' + ); + + $this->driver->purge(); + + $this->assertSame(false, $this->driver->get('test_key')); + } + + public function test_destroy() + { + $this->driver->put('first_key', 'first_value'); + $this->driver->put('second_key', 'second_value'); + + $this->assertEquals( + 'first_value', + $this->driver->get('first_key') + ); + $this->assertEquals( + 'second_value', + $this->driver->get('second_key') + ); + + $this->driver->destroy('first_key'); + + $this->assertFalse($this->driver->_exists('first_key')); + $this->assertEquals( + 'second_value', + $this->driver->get('second_key') + ); + } +} |
