mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Fix various warnings in PHP 8.0
This commit is contained in:
parent
f46b41f437
commit
60465fb2db
23 changed files with 65 additions and 55 deletions
|
|
@ -95,7 +95,7 @@ class ContextTest extends \Codeception\TestCase\Test
|
|||
Context::setRequestMethod();
|
||||
Context::setRequestArguments();
|
||||
$this->assertEquals('POST', Context::getRequestMethod());
|
||||
$this->assertNull(Context::getRequestVars()->foo);
|
||||
$this->assertNull(Context::getRequestVars()->foo ?? null);
|
||||
$this->assertNull(Context::get('foo')); // This is different from XE behavior
|
||||
|
||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@
|
|||
class OldSecurityTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
public function _before()
|
||||
{
|
||||
$this->_reset();
|
||||
}
|
||||
|
||||
protected function _reset()
|
||||
{
|
||||
/**
|
||||
* Setup mock data
|
||||
|
|
@ -40,13 +45,13 @@ class OldSecurityTest extends \Codeception\TestCase\Test
|
|||
$this->assertTrue(true);
|
||||
|
||||
// normal string - one
|
||||
$this->_before();
|
||||
$this->_reset();
|
||||
$this->assertEquals('<strong>Hello, world</strong>', Context::get('content1'));
|
||||
$security->encodeHTML('content1');
|
||||
$this->assertEquals('<strong>Hello, world</strong>', Context::get('content1'));
|
||||
|
||||
// normal string - two
|
||||
$this->_before();
|
||||
$this->_reset();
|
||||
$this->assertEquals('<strong>Hello, world</strong>', Context::get('content1'));
|
||||
$this->assertEquals('Wow, >_< !', Context::get('content2'));
|
||||
$security->encodeHTML('content1','content2');
|
||||
|
|
@ -61,7 +66,7 @@ class OldSecurityTest extends \Codeception\TestCase\Test
|
|||
$this->assertEquals(Context::get('array1'), array('<span class="first">F</span>irst','<u>S</u>econd','<b>T</b>hird'));
|
||||
$security->encodeHTML('array1.2'); // affects only third element
|
||||
$this->assertEquals(Context::get('array1'), array('<span class="first">F</span>irst','<u>S</u>econd','<b>T</b>hird'));
|
||||
$this->_before(); // reset;
|
||||
$this->_reset(); // reset;
|
||||
$this->assertEquals(Context::get('array1'), array('<span class="first">F</span>irst','<u>S</u>econd','<b>T</b>hird'));
|
||||
$security->encodeHTML('array1.'); // affects all items
|
||||
$this->assertEquals(Context::get('array1'), array('<span class="first">F</span>irst','<u>S</u>econd','<b>T</b>hird'));
|
||||
|
|
@ -74,7 +79,7 @@ class OldSecurityTest extends \Codeception\TestCase\Test
|
|||
$this->assertEquals(Context::get('array2'), array('elem1'=>'One <ins>1</ins>','elem2'=>'Two <del>2</del>','elem3'=>'Three <addr>3</addr>'));
|
||||
$security->encodeHTML('array2.elem2'); // affects only 'elem2'
|
||||
$this->assertEquals(Context::get('array2'), array('elem1'=>'One <ins>1</ins>','elem2'=>'Two <del>2</del>','elem3'=>'Three <addr>3</addr>'));
|
||||
$this->_before(); // reset;
|
||||
$this->_reset(); // reset;
|
||||
$this->assertEquals(Context::get('array2'), array('elem1'=>'One <ins>1</ins>','elem2'=>'Two <del>2</del>','elem3'=>'Three <addr>3</addr>'));
|
||||
$security->encodeHTML('array2.'); // affects all items
|
||||
$this->assertEquals(Context::get('array2'), array('elem1'=>'One <ins>1</ins>','elem2'=>'Two <del>2</del>','elem3'=>'Three <addr>3</addr>'));
|
||||
|
|
@ -94,7 +99,7 @@ class OldSecurityTest extends \Codeception\TestCase\Test
|
|||
$security->encodeHTML('object1.prop3'); // affects only 'prop3' property
|
||||
$obj->prop3 = '<strong>Strong</strong> Baby';
|
||||
$this->assertEquals(Context::get('object1'), $obj);
|
||||
$this->_before(); // reset
|
||||
$this->_reset(); // reset
|
||||
$obj->prop3 = '<strong>Strong</strong> Baby';
|
||||
$this->assertEquals(Context::get('object1'), $obj);
|
||||
$security->encodeHTML('object1.'); // affects all properties
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ class TemplateHandlerTest extends \Codeception\TestCase\Test
|
|||
// <!--%unload("../script.js",type="body")-->
|
||||
array(
|
||||
'<dummy /><!--%unload("../script.js",type="body")--><dummy />',
|
||||
'?><dummy /><?php Context::unloadFile(\'tests/unit/classes/script.js\',\'\'); ?><dummy />'
|
||||
'?><dummy /><?php Context::unloadFile(\'tests/unit/classes/script.js\', \'\'); ?><dummy />'
|
||||
),
|
||||
// comment
|
||||
array(
|
||||
|
|
@ -488,7 +488,7 @@ class TemplateHandlerTest extends \Codeception\TestCase\Test
|
|||
{
|
||||
$tmpl = new TemplateHandlerWrapper;
|
||||
$tmpl->init(__DIR__ . '/template', 'no_file.html');
|
||||
$result = $tmpl->parse($tpl);
|
||||
$result = $tmpl->parse(null);
|
||||
|
||||
$this->assertEquals('', $result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
class DateTimeTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
private $old_timezone;
|
||||
|
||||
public function _before()
|
||||
{
|
||||
// Add some dummy data to system configuration. Asia/Seoul offset is 32400.
|
||||
|
|
@ -9,14 +11,14 @@ class DateTimeTest extends \Codeception\TestCase\Test
|
|||
Rhymix\Framework\Config::set('locale.internal_timezone', 10800);
|
||||
|
||||
// Set PHP time zone to the internal time zone.
|
||||
$old_timezone = @date_default_timezone_get();
|
||||
$this->old_timezone = @date_default_timezone_get();
|
||||
date_default_timezone_set('Etc/GMT-3');
|
||||
}
|
||||
|
||||
public function _after()
|
||||
{
|
||||
// Restore the old timezone.
|
||||
date_default_timezone_set($old_timezone);
|
||||
date_default_timezone_set($this->old_timezone);
|
||||
}
|
||||
|
||||
public function testZgap()
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class RouterTest extends \Codeception\TestCase\Test
|
|||
$this->assertEquals($args, Rhymix\Framework\Router::parseURL('GET', 'board/comment/456/edit?extra_param=foo+bar', 2)->args);
|
||||
$this->assertEquals('board', Rhymix\Framework\Router::parseURL('GET', 'board/comment/456/edit?extra_param=foo+bar', 2)->mid);
|
||||
$this->assertEquals('dispBoardModifyComment', Rhymix\Framework\Router::parseURL('GET', 'board/comment/456/edit?extra_param=foo+bar', 2)->act);
|
||||
$this->assertEquals('', Rhymix\Framework\Router::parseURL('GET', 'board/comment/456/edit?extra_param=foo+bar', 2)->document_srl);
|
||||
$this->assertEquals('', Rhymix\Framework\Router::parseURL('GET', 'board/comment/456/edit?extra_param=foo+bar', 2)->document_srl ?? '');
|
||||
$this->assertEquals($args, Rhymix\Framework\Router::parseURL('GET', 'index.php?mid=board&act=dispBoardModifyComment&comment_srl=456&extra_param=foo+bar', 1)->args);
|
||||
$this->assertEquals($args, Rhymix\Framework\Router::parseURL('GET', 'index.php?mid=board&act=dispBoardModifyComment&comment_srl=456&extra_param=foo+bar', 0)->args);
|
||||
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ class SMSTest extends \Codeception\TestCase\Test
|
|||
$sms->send();
|
||||
|
||||
$messages = $driver->getSentMessages();
|
||||
$this->assertEquals('01099998888', $messages[0]->from);
|
||||
$this->assertEquals('01099998888', count($messages) ? $messages[0]->from : '');
|
||||
|
||||
config('sms.default_force', false);
|
||||
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ class SessionTest extends \Codeception\TestCase\Test
|
|||
|
||||
Rhymix\Framework\Session::destroy();
|
||||
$this->assertFalse(Rhymix\Framework\Session::verifyToken($token1));
|
||||
$this->assertFalse(Rhymix\Framework\Session::verifyToken($token, '/my/key'));
|
||||
$this->assertFalse(Rhymix\Framework\Session::verifyToken($token1, '/my/key'));
|
||||
$this->assertFalse(Rhymix\Framework\Session::getGenericToken());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,6 @@ class LangParserTest extends \Codeception\TestCase\Test
|
|||
include \RX_BASEDIR . $this->_dir . '/ja.php';
|
||||
$this->assertEquals('テスト言語', $lang->testlang);
|
||||
$this->assertEquals('<p>HTML コンテンツ</p>', $lang->testhtml);
|
||||
$this->assertNull($lang->testarray);
|
||||
$this->assertNull($lang->testarray ?? null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue