generated from vjik/package-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
Showing
8 changed files
with
944 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Vjik\Codeception\DatabasePopulator\Tests\PgSqlIntegration; | ||
|
||
use Codeception\Exception\ModuleException; | ||
use Codeception\Test\Unit; | ||
use PDO; | ||
use Vjik\Codeception\DatabasePopulator\Tests\PgSqlIntegrationTester; | ||
|
||
use function dirname; | ||
|
||
final class DatabasePopulateTest extends Unit | ||
{ | ||
/** | ||
* @var PgSqlIntegrationTester | ||
*/ | ||
protected $tester; | ||
|
||
public function testBase(): void | ||
{ | ||
$this->tester->loadDump('blog'); | ||
$this->tester->loadRows('authors'); | ||
|
||
$this->tester->seeInDatabase('author', ['id' => 1, 'name' => 'Ivan']); | ||
$this->tester->seeInDatabase('author', ['id' => 2, 'name' => 'Petr']); | ||
} | ||
|
||
public function testLoadNotExistDump(): void | ||
{ | ||
$this->expectException(ModuleException::class); | ||
$this->expectExceptionMessage( | ||
"\nFile with dump doesn't exist.\nPlease, check path for SQL-file: " . | ||
dirname(__DIR__) . '/_data/dumps/pgsql/shop.sql' | ||
); | ||
$this->tester->loadDump('shop'); | ||
} | ||
|
||
public function testLoadEmptyDump(): void | ||
{ | ||
$this->tester->loadDump('blog'); | ||
$this->tester->loadDump('empty'); | ||
|
||
/** @var PDO $pdo */ | ||
$pdo = $this->getModule('Db')->_getDbh(); | ||
$tableNames = $pdo->query('SHOW TABLES')->fetchAll(PDO::FETCH_COLUMN); | ||
|
||
$this->assertSame([], $tableNames); | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Vjik\Codeception\DatabasePopulator\Tests\PgSqlPreload; | ||
|
||
use Codeception\Test\Unit; | ||
use Vjik\Codeception\DatabasePopulator\Tests\PgSqlPreloadTester; | ||
|
||
final class PreloadTest extends Unit | ||
{ | ||
/** | ||
* @var PgSqlPreloadTester | ||
*/ | ||
protected $tester; | ||
|
||
public function testBase(): void | ||
{ | ||
$this->tester->seeInDatabase('author', ['id' => 1, 'name' => 'Ivan']); | ||
$this->tester->seeInDatabase('author', ['id' => 2, 'name' => 'Petr']); | ||
} | ||
} |
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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Vjik\Codeception\DatabasePopulator\Tests; | ||
|
||
/** | ||
* Inherited Methods | ||
* @method void wantTo($text) | ||
* @method void wantToTest($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method void pause($vars = []) | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class PgSqlIntegrationTester extends \Codeception\Actor | ||
{ | ||
use _generated\PgSqlIntegrationTesterActions; | ||
|
||
/** | ||
* Define custom actions here | ||
*/ | ||
} |
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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Vjik\Codeception\DatabasePopulator\Tests; | ||
|
||
/** | ||
* Inherited Methods | ||
* @method void wantTo($text) | ||
* @method void wantToTest($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method void pause($vars = []) | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class PgSqlPreloadTester extends \Codeception\Actor | ||
{ | ||
use _generated\PgSqlPreloadTesterActions; | ||
|
||
/** | ||
* Define custom actions here | ||
*/ | ||
} |
Oops, something went wrong.