-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SC_Query setOrder() と setLimit() の有効範囲を揃える #1116
- 共通部分 (SC_*) テスト追加 - 先日追加した SC_DB_DBFactory*Test はメンテが煩雑なので抽象化した。
- Loading branch information
1 parent
0ac03af
commit 5c7b412
Showing
5 changed files
with
199 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
class SC_DB_DBFactoryTestAbstract extends Common_TestCase | ||
{ | ||
/** | ||
* @var SC_DB_DBFactory | ||
*/ | ||
protected $dbFactory; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->dbFactory = SC_DB_DBFactory_Ex::getInstance(); | ||
} | ||
|
||
public function testGetTransactionIsolationLevel() | ||
{ | ||
$this->assertEquals(SC_DB_DBFactory_Ex::ISOLATION_LEVEL_READ_COMMITTED, $this->dbFactory->getTransactionIsolationLevel()); | ||
} | ||
|
||
public function testIsSkipDeleteIfNotExists() | ||
{ | ||
$this->assertFalse($this->dbFactory->isSkipDeleteIfNotExists()); | ||
} | ||
|
||
public function testAddLimitOffset() | ||
{ | ||
$sql_base = 'SELECT foo FROM bar ORDER BY boo'; | ||
|
||
$this->assertSame( | ||
"{$sql_base} LIMIT 2", | ||
$this->dbFactory->addLimitOffset($sql_base, 2) | ||
); | ||
|
||
$this->assertSame( | ||
"{$sql_base} OFFSET 3", | ||
$this->dbFactory->addLimitOffset($sql_base, null, 3) | ||
); | ||
|
||
$this->assertSame( | ||
"{$sql_base} LIMIT 2 OFFSET 3", | ||
$this->dbFactory->addLimitOffset($sql_base, 2, 3) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters