<?php global $th; if (!isset($th)) { require_once dirname(dirname(__DIR__)) . '/src/TestHelper.class.php'; $th = new rkphplib\TestHelper(); } $th->load('src/lib/conf2kv.php'); $th->runFuncTest('conf2kv');
<?php global $th; if (!isset($th)) { require_once dirname(dirname(__DIR__)) . '/src/TestHelper.class.php'; $th = new rkphplib\TestHelper(); } $th->load('src/DateCalc.class.php'); $th->runFuncTest('sql2num'); $th->runFuncTest('max'); $th->runFuncTest('sqlTS'); $th->runFuncTest('sqlAddMonth'); $th->runFuncTest('date2unix'); $th->runFuncTest('dmy2unix'); $th->runFuncTest('date2dmyhis'); $th->runFuncTest('date2dmy'); $th->runFuncTest('sql_date'); $th->runFuncTest('min_sec'); $th->runFuncTest('kw'); $th->runFuncTest('hms2sec'); $th->runFuncTest('sec2hms'); $th->runFuncTest('nowstr2time'); $th->runFuncTest('nextMonth'); $th->runFuncTest('prevMonth'); $th->runFuncTest('lastDay'); $th->runFuncTest('sqlDayOfYear'); $th->runFuncTest('formatDateStr'); $th->runFuncTest('formatDateTimeStr');
<?php global $th; if (!isset($th)) { require_once dirname(dirname(__DIR__)) . '/src/TestHelper.class.php'; $th = new rkphplib\TestHelper(); } /** * */ function test_exists($path_list) { $res = array(); foreach ($path_list as $path) { try { if (\rkphplib\Dir::exists($path, true)) { array_push($res, 1); } } catch (Exception $e) { array_push($res, 0); } } return $res; } $th->load('src/Dir.class.php'); $th->callTest('test_exists', array('/etc', '/etc/apache2', '/var/lib/mysql'), array('Dir::exits()', 1, 1, 0));
<?php global $th; if (!isset($th)) { require_once dirname(dirname(__DIR__)) . '/src/TestHelper.class.php'; $th = new rkphplib\TestHelper(); } $th->load('src/lib/replace_tags.php'); $th->runFuncTest('replace_tags');
<?php global $th; if (!isset($th)) { require_once dirname(dirname(__DIR__)) . '/src/TestHelper.class.php'; $th = new rkphplib\TestHelper(); } $th->load('src/Session.class.php'); $sess = new \rkphplib\Session(); $sess->init(['name' => 'test']); $th->compareHash('Session init', $sess->getMetaHash(), ['script' => 'run.php']); $th->compare('hasMeta(script)', [$sess->hasMeta('script')], [true]); $th->compare('getMeta(docroot)', [$sess->getMeta('docroot')], ['']); $sess->setMeta('host', 'localhost'); $th->compare('set|getMeta(host)', [$sess->getMeta('host')], ['localhost']); $th->compare('getConf(inactive)', [$sess->getConf('inactive')], [7200]); $th->compare('getSessionKey()', [$sess->getSessionKey()], [md5('test:docroot')]); $sess->set('abc', 3); $th->compare('has|get()', [$sess->has('abc'), $sess->get('abc')], [true, 3]); $sess->setHash(['abc' => 5, 'x' => 'a']); $th->compareHash('getHash()', $sess->getHash(), ['abc' => 5, 'x' => 'a']); $js = <<<END window.setInterval( function() { \t\$.ajax({ \t\tcache: false, \t\ttype: "GET", \t\t\turl: "test.php" \t\t\t }); }, 600000); END;
<?php global $th; if (!isset($th)) { require_once dirname(dirname(__DIR__)) . '/src/TestHelper.class.php'; $th = new rkphplib\TestHelper(); } $th->load('src/lib/split_str.php'); $th->runFuncTest('split_str');
<?php global $th; if (!isset($th)) { require_once dirname(dirname(__DIR__)) . '/src/TestHelper.class.php'; $th = new rkphplib\TestHelper(); } $th->load('src/lib/kv2conf.php'); $th->runFuncTest('kv2conf');
<?php global $th; if (!isset($th)) { require_once dirname(dirname(__DIR__)) . '/src/TestHelper.class.php'; $th = new rkphplib\TestHelper(); } $th->load('src/lib/csv_explode.php'); $th->runFuncTest('csv_explode');