mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-01 08:12:17 +09:00
Remove trailing whitespace in all unit tests
This commit is contained in:
parent
37b0d3a1e6
commit
3b77781d15
40 changed files with 840 additions and 840 deletions
|
|
@ -4,7 +4,7 @@ class LegacyTest extends \Codeception\TestCase\Test
|
|||
{
|
||||
public function testGetModule()
|
||||
{
|
||||
$this->assertTrue(getModule('board', 'controller') instanceof BoardController);
|
||||
$this->assertTrue(getModule('board', 'controller') instanceof BoardController);
|
||||
$this->assertTrue(getModule('board', 'model') instanceof BoardModel);
|
||||
$this->assertTrue(getModule('board', 'view', 'admin') instanceof BoardAdminView);
|
||||
$this->assertTrue(getModule('board') instanceof BoardView);
|
||||
|
|
@ -19,25 +19,25 @@ class LegacyTest extends \Codeception\TestCase\Test
|
|||
$this->assertTrue(getWAP('board') instanceof BoardWap);
|
||||
$this->assertTrue(getClass('board') instanceof Board);
|
||||
}
|
||||
|
||||
|
||||
public function testGetNextSequence()
|
||||
{
|
||||
if (!DB::getInstance()->isConnected())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->assertGreaterThan(0, $sequence1 = getNextSequence());
|
||||
$this->assertGreaterThan($sequence1, $sequence2 = getNextSequence());
|
||||
|
||||
|
||||
$this->assertTrue(checkUserSequence($sequence1));
|
||||
$this->assertTrue(checkUserSequence($sequence2));
|
||||
|
||||
|
||||
$this->assertFalse(checkUserSequence(-1));
|
||||
setUserSequence(-1);
|
||||
$this->assertTrue(checkUserSequence(-1));
|
||||
}
|
||||
|
||||
|
||||
public function testGetURL()
|
||||
{
|
||||
/**
|
||||
|
|
@ -55,19 +55,19 @@ class LegacyTest extends \Codeception\TestCase\Test
|
|||
* - getRequestUriByServerEnviroment()
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
public function testIsSiteID()
|
||||
{
|
||||
$this->assertTrue(isSiteID('rhymix_RHYMIX_1234'));
|
||||
$this->assertFalse(isSiteID('www.rhymix.org'));
|
||||
}
|
||||
|
||||
|
||||
public function testCutStr()
|
||||
{
|
||||
$this->assertEquals('안녕하세요? 라이믹스...', cut_str('안녕하세요? 라이믹스입니다. 제목이 너무 길어서 잘립니다.', 20));
|
||||
$this->assertEquals('Hello? This is Rhymix...', cut_str('Hello? This is Rhymix. This title is very long.', 20));
|
||||
}
|
||||
|
||||
|
||||
public function testTimeFunctions()
|
||||
{
|
||||
$this->assertEquals(0, get_time_zone_offset('00:00'));
|
||||
|
|
@ -76,11 +76,11 @@ class LegacyTest extends \Codeception\TestCase\Test
|
|||
$this->assertEquals(32400, get_time_zone_offset('0900'));
|
||||
$this->assertEquals(-18000, get_time_zone_offset('-05:00'));
|
||||
$this->assertEquals(-18000, get_time_zone_offset('-0500'));
|
||||
|
||||
|
||||
$this->assertEquals('Jan', getMonthName(1));
|
||||
$this->assertEquals('Sep', getMonthName(9, true));
|
||||
$this->assertEquals('September', getMonthName(9, false));
|
||||
|
||||
|
||||
/**
|
||||
* The following functions are tested in DateTimeTest:
|
||||
* - zgap()
|
||||
|
|
@ -91,41 +91,41 @@ class LegacyTest extends \Codeception\TestCase\Test
|
|||
* - getTimeGap()
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
public function testGetEncodedEmailAddress()
|
||||
{
|
||||
$this->assertNotEquals('devops@rhymix.org', getEncodeEmailAddress('devops@rhymix.org'));
|
||||
$this->assertStringContainsString('&#X', getEncodeEmailAddress('devops@rhymix.org'));
|
||||
}
|
||||
|
||||
|
||||
public function testGetMicrotime()
|
||||
{
|
||||
$microtime1 = microtime(true);
|
||||
$microtime2 = getMicroTime();
|
||||
$microtime3 = microtime(true);
|
||||
|
||||
|
||||
$this->assertEquals('double', gettype($microtime2));
|
||||
$this->assertGreaterThanOrEqual($microtime1, $microtime2);
|
||||
$this->assertGreaterThanOrEqual($microtime2, $microtime3);
|
||||
}
|
||||
|
||||
|
||||
public function testDelObjectVars()
|
||||
{
|
||||
$target = (object)array('foo' => 1, 'bar' => 2, 'baz' => 3, 'rhymix' => 4);
|
||||
$delete = (object)array('bar' => 5, 'baz' => 6);
|
||||
$result = delObjectVars($target, $delete);
|
||||
|
||||
|
||||
// Check if the keys were deleted from the result.
|
||||
$this->assertTrue(isset($result->foo));
|
||||
$this->assertFalse(isset($result->bar));
|
||||
$this->assertFalse(isset($result->baz));
|
||||
$this->assertTrue(isset($result->rhymix));
|
||||
|
||||
|
||||
// Check if the keys are intact in the original target.
|
||||
$this->assertTrue(isset($target->bar));
|
||||
$this->assertTrue(isset($target->baz));
|
||||
}
|
||||
|
||||
|
||||
public function testGetDestroyXeVars()
|
||||
{
|
||||
// Test array. (Keys should be intact in the original target.)
|
||||
|
|
@ -133,14 +133,14 @@ class LegacyTest extends \Codeception\TestCase\Test
|
|||
$result = getDestroyXeVars($target);
|
||||
$this->assertFalse(isset($result['xe_validator_id']));
|
||||
$this->assertTrue(isset($target['xe_validator_id']));
|
||||
|
||||
|
||||
// Test object. (Keys should be deleted from the original target.)
|
||||
$target = (object)array('foo' => 1, 'bar' => 2, 'xe_validator_id' => 3);
|
||||
$result = getDestroyXeVars($target);
|
||||
$this->assertFalse(isset($result->xe_validator_id));
|
||||
$this->assertFalse(isset($target->xe_validator_id));
|
||||
}
|
||||
|
||||
|
||||
public function testGetNumberingPath()
|
||||
{
|
||||
$this->assertEquals('001/', getNumberingPath(1));
|
||||
|
|
@ -153,44 +153,44 @@ class LegacyTest extends \Codeception\TestCase\Test
|
|||
$this->assertEquals('678/345/012/', getNumberingPath(12345678));
|
||||
$this->assertEquals('789/456/123/', getNumberingPath(123456789));
|
||||
}
|
||||
|
||||
|
||||
public function testMysqlPre4HashPassword()
|
||||
{
|
||||
$this->assertEquals('5d2e19393cc5ef67', mysql_pre4_hash_password('password'));
|
||||
$this->assertEquals('25a4fb474e17c19a', mysql_pre4_hash_password('pass\'#word'));
|
||||
}
|
||||
|
||||
|
||||
public function testJsonEncode2()
|
||||
{
|
||||
$data = array('foo' => 1, 'bar' => 2, 'baz' => 3, 'rhymix' => 4);
|
||||
$this->assertEquals(json_encode($data), json_encode2($data));
|
||||
}
|
||||
|
||||
|
||||
public function TestIsCrawler()
|
||||
{
|
||||
$original_user_agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
|
||||
|
||||
// Test automatic detection from User-Agent string.
|
||||
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Firefox/45.0';
|
||||
$this->assertFalse(isCrawler());
|
||||
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';
|
||||
$this->assertTrue(isCrawler());
|
||||
|
||||
|
||||
// Test manual detection.
|
||||
$this->assertTrue(isCrawler('Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)'));
|
||||
$this->assertTrue(isCrawler('Yeti/1.0 (NHN Corp.; http://help.naver.com/robots/)'));
|
||||
$this->assertFalse(isCrawler('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36'));
|
||||
$this->assertFalse(isCrawler('Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25'));
|
||||
|
||||
|
||||
$_SERVER['HTTP_USER_AGENT'] = $original_user_agent;
|
||||
}
|
||||
|
||||
|
||||
public function testMiscUTF8Functions()
|
||||
{
|
||||
$this->assertEquals('<img>', url_decode('%3Cimg%3E'));
|
||||
$this->assertEquals('한글 % English', utf8RawUrlDecode('%uD55C%uAE00%20%25%20English'));
|
||||
$this->assertEquals('뷁', _code2utf(48577));
|
||||
|
||||
|
||||
$this->assertTrue(detectUTF8('라이믹스'));
|
||||
$this->assertTrue(detectUTF8(urlencode('라이믹스')));
|
||||
$this->assertTrue(detectUTF8('%87%a9%43%cd%ef', false, false));
|
||||
|
|
@ -200,7 +200,7 @@ class LegacyTest extends \Codeception\TestCase\Test
|
|||
$this->assertEquals(mb_convert_encoding('라이믹스', 'UTF-8', 'CP949'), detectUTF8('라이믹스', true));
|
||||
$this->assertEquals('라이믹스', detectUTF8(iconv('UTF-8', 'EUC-KR', '라이믹스'), true));
|
||||
}
|
||||
|
||||
|
||||
public function testMiscSecurityFunctions()
|
||||
{
|
||||
/**
|
||||
|
|
@ -209,14 +209,14 @@ class LegacyTest extends \Codeception\TestCase\Test
|
|||
* - checkCSRF()
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
public function testRecurciveExposureCheck()
|
||||
{
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
public function testChangeValueInUrl()
|
||||
{
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue