/** * Test cases for _loader() and _unloader() */ public function testForFunctionsLoaderAndUnloader() { global $lc_autoload; // 1. _loader('i18n_helper'); _loader('pager_helper'); $this->assertEqual($lc_autoload, array(HELPER . 'i18n_helper.php', HELPER . 'pager_helper.php')); // 2. _unloader('session_helper'); $this->assertEqual($lc_autoload, array(HELPER . 'i18n_helper.php', HELPER . 'pager_helper.php')); // 3. _loader('session_helper'); _loader('validation_helper'); _loader('auth_helper'); _loader('security_helper'); _loader('form_helper'); _loader('file_helper'); $this->assertEqual($lc_autoload, array(HELPER . 'i18n_helper.php', HELPER . 'pager_helper.php', HELPER . 'session_helper.php', HELPER . 'validation_helper.php', HELPER . 'auth_helper.php', HELPER . 'security_helper.php', HELPER . 'form_helper.php', HELPER . 'file_helper.php')); // 4. _unloader('file_helper'); _unloader('pager_helper'); $this->assertEqual($lc_autoload, array(HELPER . 'i18n_helper.php', HELPER . 'session_helper.php', HELPER . 'validation_helper.php', HELPER . 'auth_helper.php', HELPER . 'security_helper.php', HELPER . 'form_helper.php')); }
# Form helper (unloadable from /inc/autoload.php) if ($file = _i('helpers/form_helper.php', false)) { include $file; } if ($moduleForm = _readyloader('form_helper')) { require $moduleForm; } _unloader('form_helper', HELPER); # File helper if ($file = _i('helpers/file_helper.php', false)) { include $file; } if ($moduleFile = _readyloader('file_helper')) { require $moduleFile; } _unloader('file_helper', HELPER); # Global Authentication Object $_auth = $moduleAuth ? auth_get() : null; # Check security prerequisite security_prerequisite(); $module = null; foreach ($lc_autoload as $file) { if ($module = _readyloader($file)) { require $module; } } unset($module); unset($file); unset($commandDirs); unset($cmdDir); # Composer Autoloader