Skip to content

Commit

Permalink
Update WordPress\Orm\DatabaseTest
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitriBouteille committed Oct 9, 2024
1 parent b976273 commit 1a2eb34
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions tests/WordPress/Orm/DatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
use Dbout\WpOrm\Orm\Database;
use Dbout\WpOrm\Tests\WordPress\TestCase;

/**
* @coversDefaultClass \Dbout\WpOrm\Orm\Database
*/
class DatabaseTest extends TestCase
{
private Database $database;
Expand All @@ -29,7 +26,7 @@ public function setUp(): void

/**
* @return void
* @covers ::getTablePrefix
* @covers Database::getTablePrefix
*/
public function testGetTablePrefix(): void
{
Expand All @@ -39,8 +36,8 @@ public function testGetTablePrefix(): void

/**
* @return void
* @covers ::getDatabaseName
* @covers ::getConfig
* @covers Database::getDatabaseName
* @covers Database::getConfig
*/
public function testGetDatabaseName(): void
{
Expand All @@ -49,8 +46,8 @@ public function testGetDatabaseName(): void

/**
* @return void
* @covers ::getName
* @covers ::getConfig
* @covers Database::getName
* @covers Database::getConfig
*/
public function testGetName(): void
{
Expand All @@ -62,7 +59,7 @@ public function testGetName(): void
* @param string|null $alias
* @param string $expectedQuery
* @return void
* @covers ::table
* @covers Database::table
* @dataProvider providerTestTable
*/
public function testTable(string $table, ?string $alias, string $expectedQuery): void
Expand All @@ -79,19 +76,19 @@ protected function providerTestTable(): \Generator
yield 'Without alias' => [
'options',
null,
sprintf('select * from "%s"', $this->getTable('options')),
sprintf('select * from `%s`', $this->getTable('options')),
];

yield 'With alias' => [
'options',
'opts',
sprintf('select * from "%s" as "opts"', $this->getTable('options')),
sprintf('select * from `%s` as `opts`', $this->getTable('options')),
];
}

/**
* @return void
* @covers ::lastInsertId
* @covers Database::lastInsertId
*/
public function testLastInsertId(): void
{
Expand Down

0 comments on commit 1a2eb34

Please sign in to comment.