mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +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
|
|
@ -7,7 +7,7 @@ class DBTest extends \Codeception\TestCase\Test
|
|||
$oDB = Rhymix\Framework\DB::getInstance();
|
||||
$oDB->setDebugComment(false);
|
||||
}
|
||||
|
||||
|
||||
public function testGetInstance()
|
||||
{
|
||||
$oDB = Rhymix\Framework\DB::getInstance();
|
||||
|
|
@ -15,12 +15,12 @@ class DBTest extends \Codeception\TestCase\Test
|
|||
$this->assertTrue($oDB->isConnected());
|
||||
$this->assertTrue($oDB->getHandle() instanceof Rhymix\Framework\Helpers\DBHelper);
|
||||
}
|
||||
|
||||
|
||||
public function testPrepare()
|
||||
{
|
||||
$oDB = Rhymix\Framework\DB::getInstance();
|
||||
$prefix = Rhymix\Framework\Config::get('db.master.prefix');
|
||||
|
||||
|
||||
$stmt = $oDB->prepare('SELECT * FROM documents WHERE document_srl = ?');
|
||||
$this->assertTrue($stmt instanceof Rhymix\Framework\Helpers\DBStmtHelper);
|
||||
if ($prefix)
|
||||
|
|
@ -31,19 +31,19 @@ class DBTest extends \Codeception\TestCase\Test
|
|||
{
|
||||
$this->assertEquals('SELECT * FROM documents WHERE document_srl = ?', $stmt->queryString);
|
||||
}
|
||||
|
||||
|
||||
$this->assertTrue($stmt->execute([123]));
|
||||
$this->assertTrue($stmt->execute([456]));
|
||||
$this->assertTrue($stmt->execute([789]));
|
||||
$this->assertTrue(is_array($stmt->fetchAll()));
|
||||
$this->assertTrue($stmt->closeCursor());
|
||||
}
|
||||
|
||||
|
||||
public function testQuery()
|
||||
{
|
||||
$oDB = Rhymix\Framework\DB::getInstance();
|
||||
$prefix = Rhymix\Framework\Config::get('db.master.prefix');
|
||||
|
||||
|
||||
$stmt = $oDB->query('SELECT * FROM documents WHERE document_srl = 123');
|
||||
$this->assertTrue($stmt instanceof Rhymix\Framework\Helpers\DBStmtHelper);
|
||||
if ($prefix)
|
||||
|
|
@ -54,10 +54,10 @@ class DBTest extends \Codeception\TestCase\Test
|
|||
{
|
||||
$this->assertEquals('SELECT * FROM documents WHERE document_srl = 123', $stmt->queryString);
|
||||
}
|
||||
|
||||
|
||||
$this->assertTrue(is_array($stmt->fetchAll()));
|
||||
$this->assertTrue($stmt->closeCursor());
|
||||
|
||||
|
||||
$stmt = $oDB->query('SELECT * FROM documents WHERE document_srl = ?', [123]);
|
||||
$this->assertTrue($stmt instanceof Rhymix\Framework\Helpers\DBStmtHelper);
|
||||
if ($prefix)
|
||||
|
|
@ -68,10 +68,10 @@ class DBTest extends \Codeception\TestCase\Test
|
|||
{
|
||||
$this->assertEquals('SELECT * FROM documents WHERE document_srl = ?', $stmt->queryString);
|
||||
}
|
||||
|
||||
|
||||
$this->assertTrue(is_array($stmt->fetchAll()));
|
||||
$this->assertTrue($stmt->closeCursor());
|
||||
|
||||
|
||||
$stmt = $oDB->query('SELECT * FROM documents WHERE document_srl = ? AND status = ?', 123, 'PUBLIC');
|
||||
$this->assertTrue($stmt instanceof Rhymix\Framework\Helpers\DBStmtHelper);
|
||||
if ($prefix)
|
||||
|
|
@ -82,48 +82,48 @@ class DBTest extends \Codeception\TestCase\Test
|
|||
{
|
||||
$this->assertEquals('SELECT * FROM documents WHERE document_srl = ? AND status = ?', $stmt->queryString);
|
||||
}
|
||||
|
||||
|
||||
$this->assertTrue(is_array($stmt->fetchAll()));
|
||||
$this->assertTrue($stmt->closeCursor());
|
||||
}
|
||||
|
||||
|
||||
public function testAddPrefixes()
|
||||
{
|
||||
$oDB = Rhymix\Framework\DB::getInstance();
|
||||
$prefix = Rhymix\Framework\Config::get('db.master.prefix');
|
||||
|
||||
|
||||
$source = 'SELECT a, b, c FROM documents JOIN comments ON documents.document_srl = comment.document_srl WHERE documents.member_srl = ?';
|
||||
$target = 'SELECT a, b, c FROM `' . $prefix . 'documents` AS `documents` JOIN `' . $prefix . 'comments` AS `comments` ' .
|
||||
'ON documents.document_srl = comment.document_srl WHERE documents.member_srl = ?';
|
||||
$this->assertEquals($target, $oDB->addPrefixes($source));
|
||||
|
||||
|
||||
$source = 'SELECT a AS aa FROM documents as foo JOIN bar ON documents.a = bar.a';
|
||||
$target = 'SELECT a AS aa FROM `' . $prefix . 'documents` AS `foo` JOIN `' . $prefix . 'bar` AS `bar` ON documents.a = bar.a';
|
||||
$this->assertEquals($target, $oDB->addPrefixes($source));
|
||||
|
||||
|
||||
$source = 'INSERT INTO documents (a, b, c) VALUES (?, ?, ?)';
|
||||
$target = 'INSERT INTO `' . $prefix . 'documents` (a, b, c) VALUES (?, ?, ?)';
|
||||
$this->assertEquals($target, $oDB->addPrefixes($source));
|
||||
|
||||
|
||||
$source = 'INSERT INTO documents (a, b, c) SELECT d, e, f FROM old_documents WHERE g = ?';
|
||||
$target = 'INSERT INTO `' . $prefix . 'documents` (a, b, c) SELECT d, e, f FROM `' . $prefix . 'old_documents` AS `old_documents` WHERE g = ?';
|
||||
$this->assertEquals($target, $oDB->addPrefixes($source));
|
||||
|
||||
|
||||
$source = 'UPDATE documents SET a = ?, b = ? WHERE c = ?';
|
||||
$target = 'UPDATE `' . $prefix . 'documents` SET a = ?, b = ? WHERE c = ?';
|
||||
$this->assertEquals($target, $oDB->addPrefixes($source));
|
||||
|
||||
|
||||
$source = 'DELETE FROM documents WHERE d = ?';
|
||||
$target = 'DELETE FROM `' . $prefix . 'documents` WHERE d = ?';
|
||||
$this->assertEquals($target, $oDB->addPrefixes($source));
|
||||
|
||||
|
||||
$source = 'update documents set a = ?, b = ? where c = ?';
|
||||
$this->assertEquals($source, $oDB->addPrefixes($source));
|
||||
|
||||
|
||||
$source = 'delete from documents where d = ?';
|
||||
$this->assertEquals($source, $oDB->addPrefixes($source));
|
||||
}
|
||||
|
||||
|
||||
public function testIsTableColumnIndexExists()
|
||||
{
|
||||
$oDB = Rhymix\Framework\DB::getInstance();
|
||||
|
|
@ -134,7 +134,7 @@ class DBTest extends \Codeception\TestCase\Test
|
|||
$this->assertFalse($oDB->isColumnExists('documents', 'document_nx'));
|
||||
$this->assertFalse($oDB->isIndexExists('documents', 'idx_regex'));
|
||||
}
|
||||
|
||||
|
||||
public function testGetColumnInfo()
|
||||
{
|
||||
$oDB = Rhymix\Framework\DB::getInstance();
|
||||
|
|
@ -146,7 +146,7 @@ class DBTest extends \Codeception\TestCase\Test
|
|||
$this->assertNull($info->default_value);
|
||||
$this->assertTrue($info->notnull);
|
||||
}
|
||||
|
||||
|
||||
public function testIsValidOldPassword()
|
||||
{
|
||||
$oDB = Rhymix\Framework\DB::getInstance();
|
||||
|
|
@ -160,7 +160,7 @@ class DBTest extends \Codeception\TestCase\Test
|
|||
$this->assertFalse($oDB->isValidOldPassword($password, $saved3));
|
||||
$this->assertFalse($oDB->isValidOldPassword($password, $saved4));
|
||||
}
|
||||
|
||||
|
||||
public function testAddQuotes()
|
||||
{
|
||||
$oDB = Rhymix\Framework\DB::getInstance();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue