diff options
-rw-r--r-- | inc/Cache/Cache.php | 13 | ||||
-rw-r--r-- | inc/Cache/CacheInstructions.php | 2 | ||||
-rw-r--r-- | lib/plugins/usermanager/_test/csv_import.test.php | 38 |
3 files changed, 32 insertions, 21 deletions
diff --git a/inc/Cache/Cache.php b/inc/Cache/Cache.php index ab64da5cb..af82e6bf6 100644 --- a/inc/Cache/Cache.php +++ b/inc/Cache/Cache.php @@ -78,9 +78,13 @@ class Cache $this->depends = $depends; $this->addDependencies(); - if ($this->_event) { - return $this->stats(Event::createAndTrigger( - $this->_event, $this, array($this, 'makeDefaultCacheDecision')) + if ($this->getEvent()) { + return $this->stats( + Event::createAndTrigger( + $this->getEvent(), + $this, + array($this, 'makeDefaultCacheDecision') + ) ); } @@ -105,7 +109,6 @@ class Cache */ public function makeDefaultCacheDecision() { - if ($this->_nocache) { return false; } // caching turned off @@ -170,7 +173,7 @@ class Cache return false; } - return io_savefile($this->cache, $data); + return io_saveFile($this->cache, $data); } /** diff --git a/inc/Cache/CacheInstructions.php b/inc/Cache/CacheInstructions.php index 3c4786105..acd02abae 100644 --- a/inc/Cache/CacheInstructions.php +++ b/inc/Cache/CacheInstructions.php @@ -41,6 +41,6 @@ class CacheInstructions extends \dokuwiki\Cache\CacheParser return false; } - return io_savefile($this->cache, serialize($instructions)); + return io_saveFile($this->cache, serialize($instructions)); } } diff --git a/lib/plugins/usermanager/_test/csv_import.test.php b/lib/plugins/usermanager/_test/csv_import.test.php index 6047a9342..13034a012 100644 --- a/lib/plugins/usermanager/_test/csv_import.test.php +++ b/lib/plugins/usermanager/_test/csv_import.test.php @@ -14,13 +14,14 @@ require_once(dirname(__FILE__).'/mocks.class.php'); * * At present, users imported in individual tests remain in the user list for subsequent tests */ -class plugin_usermanager_csv_import_test extends DokuWikiTest { - +class plugin_usermanager_csv_import_test extends DokuWikiTest +{ private $old_files; protected $usermanager; protected $importfile; - function setUp() { + public function setUp() + { $this->importfile = tempnam(TMP_DIR, 'csv'); $this->old_files = $_FILES; @@ -38,16 +39,18 @@ class plugin_usermanager_csv_import_test extends DokuWikiTest { parent::setUp(); } - function tearDown() { + public function tearDown() + { $_FILES = $this->old_files; parent::tearDown(); } - function doImportTest($importCsv, $expectedResult, $expectedNewUsers, $expectedFailures) { + public function doImportTest($importCsv, $expectedResult, $expectedNewUsers, $expectedFailures) + { global $auth; $before_users = $auth->retrieveUsers(); - io_savefile($this->importfile, $importCsv); + io_saveFile($this->importfile, $importCsv); $result = $this->usermanager->tryImport(); $after_users = $auth->retrieveUsers(); @@ -69,7 +72,8 @@ class plugin_usermanager_csv_import_test extends DokuWikiTest { $this->assertEquals($expectedFailures, $this->usermanager->getImportFailures()); // failures as expected } - function test_cantImport(){ + public function test_cantImport() + { global $auth; $oldauth = $auth; @@ -85,7 +89,8 @@ importuser,"Ford Prefect",ford@example.com,user $auth = $oldauth; } - function test_import() { + public function test_import() + { $csv = 'User,"Real Name",Email,Groups importuser,"Ford Prefect",ford@example.com,user '; @@ -100,7 +105,8 @@ importuser,"Ford Prefect",ford@example.com,user $this->doImportTest($csv, true, $expected, array()); } - function test_importExisting() { + public function test_importExisting() + { $csv = 'User,"Real Name",Email,Groups importuser,"Ford Prefect",ford@example.com,user '; @@ -120,7 +126,8 @@ importuser,"Ford Prefect",ford@example.com,user $this->doImportTest($csv, true, array(), $failures); } - function test_importUtf8() { + public function test_importUtf8() + { $csv = 'User,"Real Name",Email,Groups importutf8,"Førd Prefect",ford@example.com,user '; @@ -138,7 +145,8 @@ importutf8,"Førd Prefect",ford@example.com,user /** * utf8: u+00F8 (ø) <=> 0xF8 :iso-8859-1 */ - function test_importIso8859() { + public function test_importIso8859() + { $csv = 'User,"Real Name",Email,Groups importiso8859,"F'.chr(0xF8).'rd Prefect",ford@example.com,user '; @@ -153,14 +161,16 @@ importiso8859,"F'.chr(0xF8).'rd Prefect",ford@example.com,user $this->doImportTest($csv, true, $expected, array()); } - private function stripPasswords($array){ + private function stripPasswords($array) + { foreach ($array as $user => $data) { unset($array[$user]['pass']); } return $array; } - private function countPasswords($array){ + private function countPasswords($array) + { $count = 0; foreach ($array as $user => $data) { if (!empty($data['pass'])) { @@ -169,6 +179,4 @@ importiso8859,"F'.chr(0xF8).'rd Prefect",ford@example.com,user } return $count; } - } - |