generated from yii-tools/template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26e124a
commit 15d2ebb
Showing
8 changed files
with
166 additions
and
0 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,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace yiiunit\framework\db\connection; | ||
|
||
use yii\db\Connection; | ||
use yii\db\Schema; | ||
|
||
abstract class AbstractConnection extends \yiiunit\TestCase | ||
{ | ||
protected Connection|null $db = null; | ||
|
||
protected function tearDown(): void | ||
{ | ||
$this->db->close(); | ||
$this->db = null; | ||
|
||
parent::tearDown(); | ||
} | ||
|
||
public function testHasTable(): void | ||
{ | ||
$tableName = 'T_table'; | ||
$this->assertFalse($this->db->hasTable($tableName)); | ||
|
||
$result = $this->db->createCommand()->createTable( | ||
$tableName, | ||
[ | ||
'id' => Schema::TYPE_PK, | ||
'name' => Schema::TYPE_STRING, | ||
], | ||
)->execute(); | ||
|
||
$this->assertSame(0, $result); | ||
|
||
$this->assertTrue($this->db->hasTable($tableName)); | ||
|
||
$result = $this->db->createCommand()->dropTable($tableName)->execute(); | ||
|
||
$this->assertSame(0, $result); | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace yiiunit\framework\db\mssql\command; | ||
|
||
use yiiunit\support\MssqlConnection; | ||
|
||
/** | ||
* @group db | ||
* @group mssql | ||
* @group connection | ||
*/ | ||
final class ConnectionTest extends \yiiunit\framework\db\connection\AbstractConnection | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->db = MssqlConnection::getConnection(); | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace yiiunit\framework\db\mysql\command; | ||
|
||
use yiiunit\support\MysqlConnection; | ||
|
||
/** | ||
* @group db | ||
* @group mysql | ||
* @group connection | ||
*/ | ||
final class ConnectionTest extends \yiiunit\framework\db\connection\AbstractConnection | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->db = MysqlConnection::getConnection(); | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace yiiunit\framework\db\oci\command; | ||
|
||
use yiiunit\support\OciConnection; | ||
|
||
/** | ||
* @group db | ||
* @group oci | ||
* @group connection | ||
*/ | ||
final class ConnectionTest extends \yiiunit\framework\db\connection\AbstractConnection | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->db = OciConnection::getConnection(); | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace yiiunit\framework\db\pgsql\command; | ||
|
||
use yiiunit\support\PgsqlConnection; | ||
|
||
/** | ||
* @group db | ||
* @group pgsql | ||
* @group connection | ||
*/ | ||
final class ConnectionTest extends \yiiunit\framework\db\connection\AbstractConnection | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->db = PgsqlConnection::getConnection(); | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace yiiunit\framework\db\sqlite\command; | ||
|
||
use yiiunit\support\SqliteConnection; | ||
|
||
/** | ||
* @group db | ||
* @group sqlite | ||
* @group connection | ||
*/ | ||
final class ConnectionTest extends \yiiunit\framework\db\connection\AbstractConnection | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->db = SqliteConnection::getConnection(); | ||
} | ||
} |