Created
July 31, 2024 18:50
-
-
Save andergmartins/f9c61dd032fe49d2a1efdb46d3756422 to your computer and use it in GitHub Desktop.
Get direct connection to Codeception Integration test DB
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
<?php | |
// This works inside a test class that extends \lucatume\WPBrowser\TestCase\WPTestCase. | |
$loaderConfig = $this->getModule('lucatume\WPBrowser\Module\WPLoader')->_getConfig(); | |
$db = new \lucatume\WPBrowser\WordPress\Database\MysqlDatabase( | |
$loaderConfig['dbName'], | |
$loaderConfig['dbUser'], | |
$loaderConfig['dbPassword'], | |
$loaderConfig['dbHost'], | |
$loaderConfig['tablePrefix'] | |
); | |
$pdo = $db->getPdo(); | |
$statement = $pdo->prepare('SHOW TABLES'); | |
$statement->execute(); | |
$tables = $statement->fetchAll(); | |
ray($tables); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment