mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 00:41:59 +01:00
Updated php unit tests to support php 8
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
85ccca9acb
commit
08ed11d517
@ -360,7 +360,7 @@ define('NOW', time());
|
||||
* normally you don't have to change anything below
|
||||
*/
|
||||
|
||||
require_once 'SYSCONFDIR/piler/config-site.php';
|
||||
if(file_exists('SYSCONFDIR/piler/config-site.php')) { require_once 'SYSCONFDIR/piler/config-site.php'; }
|
||||
|
||||
ini_set('session.cookie_lifetime', $config['SESSION_EXPIRY']);
|
||||
|
||||
|
@ -12,7 +12,10 @@ class Language {
|
||||
|
||||
if($session->get("lang")) {
|
||||
$file = DIR_LANGUAGE . $session->get("lang") . '/messages.php';
|
||||
define('LANG', $session->get("lang"));
|
||||
if(defined('LANG')) {}
|
||||
else {
|
||||
define('LANG', $session->get("lang"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$pref_langs = $this->get_preferred_languages();
|
||||
|
@ -2,12 +2,11 @@
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
define('DIR_BASE', $_ENV['DIR_BASE']);
|
||||
define('MAX_EMAIL_LEN', 41);
|
||||
|
||||
include_once(DIR_BASE . "system/model.php");
|
||||
include_once(DIR_BASE . "model/search/search.php");
|
||||
|
||||
require_once dirname(dirname(__FILE__)) . '/config.php';
|
||||
require_once dirname(dirname(__FILE__)) . '/system/model.php';
|
||||
require_once dirname(dirname(__FILE__)) . '/system/loader.php';
|
||||
require_once dirname(dirname(__FILE__)) . '/system/language.php';
|
||||
require_once dirname(dirname(__FILE__)) . '/system/misc.php';
|
||||
|
||||
final class SearchSearchTest extends TestCase {
|
||||
|
||||
@ -27,7 +26,15 @@ final class SearchSearchTest extends TestCase {
|
||||
*/
|
||||
|
||||
public function test_get_boundary($input, $expected_result) {
|
||||
$result = ModelSearchSearch::fix_email_address_for_sphinx($input);
|
||||
$loader = new Loader();
|
||||
Registry::set('load', $loader);
|
||||
$language = new Language();
|
||||
Registry::set('language', $language);
|
||||
|
||||
$loader->load->model('search/search');
|
||||
$m = new ModelSearchSearch();
|
||||
|
||||
$result = $m->fix_email_address_for_sphinx($input);
|
||||
$this->assertEquals($result, $expected_result);
|
||||
}
|
||||
|
||||
|
@ -2,9 +2,11 @@
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
include_once("system/model.php");
|
||||
include_once("system/misc.php");
|
||||
include_once("model/health/health.php");
|
||||
require_once dirname(dirname(__FILE__)) . '/config.php';
|
||||
require_once dirname(dirname(__FILE__)) . '/system/model.php';
|
||||
require_once dirname(dirname(__FILE__)) . '/system/loader.php';
|
||||
require_once dirname(dirname(__FILE__)) . '/system/language.php';
|
||||
require_once dirname(dirname(__FILE__)) . '/system/misc.php';
|
||||
|
||||
final class FormatTest extends TestCase
|
||||
{
|
||||
@ -22,7 +24,15 @@ final class FormatTest extends TestCase
|
||||
*/
|
||||
|
||||
public function test_format_time_1($timeval, $expected_result) {
|
||||
$result = ModelHealthHealth::format_time($timeval);
|
||||
$loader = new Loader();
|
||||
Registry::set('load', $loader);
|
||||
$language = new Language();
|
||||
Registry::set('language', $language);
|
||||
|
||||
$loader->load->model('health/health');
|
||||
$m = new ModelHealthHealth();
|
||||
|
||||
$result = $m->format_time($timeval);
|
||||
$this->assertEquals($result, $expected_result);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user