Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /** the function under test */
- public function set($key, $value)
- {
- file_put_contents(
- $key,
- '<?php return ' . var_export($value, true) . ';'
- );
- }
- /** a single test to check that the $key is used as filename */
- /**
- * @requires extension uopz
- */
- public function testSetUsesKeyAsFileNameToPersistCacheIn()
- {
- uopz_backup('file_put_contents');
- $that = $this;
- uopz_function(
- 'file_put_contents',
- function(
- $filename,
- $flags = false,
- $context = null,
- $offset = -1
- //$maxlen = null
- ) use ($that) {
- $that->assertSame(
- $filename,
- 'testFileName'
- );
- }
- );
- uopz_restore('file_put_contents');
- $this->cache->set('testFileName', 'test');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement