style fixes
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
logs
|
logs
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
|
.php-cs-fixer.cache
|
@ -1,39 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @package PostgreSQL_For_Wordpress
|
* @package PostgreSQL_For_Wordpress
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @author Hawk__, www.hawkix.net
|
* @author Hawk__, www.hawkix.net
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file does all the initialisation tasks
|
* This file does all the initialisation tasks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// This is required by class-wpdb so we must load it first
|
// This is required by class-wpdb so we must load it first
|
||||||
require_once ABSPATH . '/wp-includes/version.php';
|
require_once ABSPATH . '/wp-includes/version.php';
|
||||||
require_once ABSPATH . '/wp-includes/cache.php';
|
require_once ABSPATH . '/wp-includes/cache.php';
|
||||||
require_once ABSPATH . '/wp-includes/l10n.php';
|
require_once ABSPATH . '/wp-includes/l10n.php';
|
||||||
|
|
||||||
// Load the driver defined in 'db.php'
|
// Load the driver defined in 'db.php'
|
||||||
require_once(PG4WP_ROOT . '/driver_' . DB_DRIVER . '.php');
|
require_once(PG4WP_ROOT . '/driver_' . DB_DRIVER . '.php');
|
||||||
|
|
||||||
// This loads up the wpdb class applying appropriate changes to it
|
// This loads up the wpdb class applying appropriate changes to it
|
||||||
$replaces = array(
|
$replaces = array(
|
||||||
'define( ' => '// define( ',
|
'define( ' => '// define( ',
|
||||||
'class wpdb' => 'class wpdb2',
|
'class wpdb' => 'class wpdb2',
|
||||||
'new wpdb' => 'new wpdb2',
|
'new wpdb' => 'new wpdb2',
|
||||||
'instanceof mysqli_result' => 'instanceof \PgSql\Result',
|
'instanceof mysqli_result' => 'instanceof \PgSql\Result',
|
||||||
'instanceof mysqli' => 'instanceof \PgSql\Connection',
|
'instanceof mysqli' => 'instanceof \PgSql\Connection',
|
||||||
'$this->dbh->connect_errno' => 'wpsqli_connect_error()',
|
'$this->dbh->connect_errno' => 'wpsqli_connect_error()',
|
||||||
'mysqli_' => 'wpsqli_',
|
'mysqli_' => 'wpsqli_',
|
||||||
'is_resource' => 'wpsqli_is_resource',
|
'is_resource' => 'wpsqli_is_resource',
|
||||||
'<?php' => '',
|
'<?php' => '',
|
||||||
'?>' => '',
|
'?>' => '',
|
||||||
);
|
);
|
||||||
|
|
||||||
eval(str_replace(array_keys($replaces), array_values($replaces), file_get_contents(ABSPATH . '/wp-includes/class-wpdb.php')));
|
eval(str_replace(array_keys($replaces), array_values($replaces), file_get_contents(ABSPATH . '/wp-includes/class-wpdb.php')));
|
||||||
|
|
||||||
// Create wpdb object if not already done
|
// Create wpdb object if not already done
|
||||||
if (!isset($wpdb) && defined('DB_USER')) {
|
if (!isset($wpdb) && defined('DB_USER')) {
|
||||||
$wpdb = new wpdb2(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
|
$wpdb = new wpdb2(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
|
||||||
}
|
}
|
||||||
|
@ -178,8 +178,8 @@ function wpsqli_thread_id($connection)
|
|||||||
/**
|
/**
|
||||||
* Returns whether the client library is thread-safe.
|
* Returns whether the client library is thread-safe.
|
||||||
*
|
*
|
||||||
* This function is a wrapper for the mysqli_thread_safe function. It indicates whether the
|
* This function is a wrapper for the mysqli_thread_safe function. It indicates whether the
|
||||||
* mysqli client library that PHP is using is thread-safe. This is important information when
|
* mysqli client library that PHP is using is thread-safe. This is important information when
|
||||||
* running PHP in a multi-threaded environment such as with the worker MPM in Apache or when
|
* running PHP in a multi-threaded environment such as with the worker MPM in Apache or when
|
||||||
* using multi-threading extensions in PHP.
|
* using multi-threading extensions in PHP.
|
||||||
*
|
*
|
||||||
@ -246,9 +246,9 @@ function wpsqli_connect_errno()
|
|||||||
* Returns a string description of the last connect error.
|
* Returns a string description of the last connect error.
|
||||||
*
|
*
|
||||||
* This function is a wrapper for the mysqli_connect_error function. It provides a textual description
|
* This function is a wrapper for the mysqli_connect_error function. It provides a textual description
|
||||||
* of the error from the last connection attempt made by mysqli_connect() or mysqli_real_connect().
|
* of the error from the last connection attempt made by mysqli_connect() or mysqli_real_connect().
|
||||||
* Unlike mysqli_connect_errno(), which returns an error code, mysqli_connect_error() returns a string
|
* Unlike mysqli_connect_errno(), which returns an error code, mysqli_connect_error() returns a string
|
||||||
* describing the error. This is useful for error handling, providing more detailed context about
|
* describing the error. This is useful for error handling, providing more detailed context about
|
||||||
* connection problems.
|
* connection problems.
|
||||||
*
|
*
|
||||||
* @return string|null A string that describes the error from the last connection attempt, or NULL
|
* @return string|null A string that describes the error from the last connection attempt, or NULL
|
||||||
@ -594,14 +594,14 @@ function wpsqli_fetch_object($result, $class = "stdClass", $constructor_args = [
|
|||||||
* Fetches one row of data from the result set and returns it as an enumerated array.
|
* Fetches one row of data from the result set and returns it as an enumerated array.
|
||||||
* Each call to this function will retrieve the next row in the result set, so it's typically
|
* Each call to this function will retrieve the next row in the result set, so it's typically
|
||||||
* used in a loop to process multiple rows.
|
* used in a loop to process multiple rows.
|
||||||
*
|
*
|
||||||
* This function is particularly useful when you need to retrieve a row as a simple array
|
* This function is particularly useful when you need to retrieve a row as a simple array
|
||||||
* where each column is accessed by an integer index starting at 0. It does not include
|
* where each column is accessed by an integer index starting at 0. It does not include
|
||||||
* column names as keys, which can be marginally faster and less memory intensive than
|
* column names as keys, which can be marginally faster and less memory intensive than
|
||||||
* associative arrays if the column names are not required.
|
* associative arrays if the column names are not required.
|
||||||
*
|
*
|
||||||
* @param mysqli_result $result The result set returned by a query against the database.
|
* @param mysqli_result $result The result set returned by a query against the database.
|
||||||
*
|
*
|
||||||
* @return array|null Returns an enumerated array of strings representing the fetched row,
|
* @return array|null Returns an enumerated array of strings representing the fetched row,
|
||||||
* or NULL if there are no more rows in the result set.
|
* or NULL if there are no more rows in the result set.
|
||||||
*/
|
*/
|
||||||
@ -615,14 +615,14 @@ function wpsqli_fetch_row(mysqli_result $result): ?array
|
|||||||
* $result object. This function can be used in conjunction with mysqli_fetch_row(),
|
* $result object. This function can be used in conjunction with mysqli_fetch_row(),
|
||||||
* mysqli_fetch_assoc(), mysqli_fetch_array(), or mysqli_fetch_object() to navigate between
|
* mysqli_fetch_assoc(), mysqli_fetch_array(), or mysqli_fetch_object() to navigate between
|
||||||
* rows in result sets, especially when using buffered result sets.
|
* rows in result sets, especially when using buffered result sets.
|
||||||
*
|
*
|
||||||
* This is an important function for situations where you need to access a specific row
|
* This is an important function for situations where you need to access a specific row
|
||||||
* directly without iterating over all preceding rows, which can be useful for pagination
|
* directly without iterating over all preceding rows, which can be useful for pagination
|
||||||
* or when looking up specific rows by row number.
|
* or when looking up specific rows by row number.
|
||||||
*
|
*
|
||||||
* @param mysqli_result $result The result set returned by a query against the database.
|
* @param mysqli_result $result The result set returned by a query against the database.
|
||||||
* @param int $row_number The desired row number to seek to. Row numbers are zero-indexed.
|
* @param int $row_number The desired row number to seek to. Row numbers are zero-indexed.
|
||||||
*
|
*
|
||||||
* @return bool Returns TRUE on success or FALSE on failure. If the row number is out of range,
|
* @return bool Returns TRUE on success or FALSE on failure. If the row number is out of range,
|
||||||
* it returns FALSE.
|
* it returns FALSE.
|
||||||
*/
|
*/
|
||||||
@ -983,4 +983,4 @@ function wpsqli_poll(&...$args)
|
|||||||
function wpsqli_reap_async_query($connection)
|
function wpsqli_reap_async_query($connection)
|
||||||
{
|
{
|
||||||
return mysqli_reap_async_query($connection);
|
return mysqli_reap_async_query($connection);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ $GLOBALS['pg4wp_conn'] = false;
|
|||||||
*/
|
*/
|
||||||
function wpsqli_init()
|
function wpsqli_init()
|
||||||
{
|
{
|
||||||
return new class {
|
return new class () {
|
||||||
public $sslkey;
|
public $sslkey;
|
||||||
public $sslcert;
|
public $sslcert;
|
||||||
public $sslca;
|
public $sslca;
|
||||||
@ -48,7 +48,7 @@ function wpsqli_init()
|
|||||||
* password, database name, port number, socket, and flags, The flags parameter can be used to set different
|
* password, database name, port number, socket, and flags, The flags parameter can be used to set different
|
||||||
* connection options that can affect the behavior of the connection.
|
* connection options that can affect the behavior of the connection.
|
||||||
*
|
*
|
||||||
* @param $connection dummy parameter just for compatibility with mysqli
|
* @param $connection dummy parameter just for compatibility with mysqli
|
||||||
* @param string|null $hostname The host name or an IP address.
|
* @param string|null $hostname The host name or an IP address.
|
||||||
* @param string|null $username The PostgreSQL user name.
|
* @param string|null $username The PostgreSQL user name.
|
||||||
* @param string|null $password The password associated with the username.
|
* @param string|null $password The password associated with the username.
|
||||||
@ -76,7 +76,7 @@ function wpsqli_real_connect(&$connection, $hostname = null, $username = null, $
|
|||||||
|
|
||||||
if (!empty($password)) {
|
if (!empty($password)) {
|
||||||
$GLOBALS['pg4wp_connstr'] .= ' password=' . $password;
|
$GLOBALS['pg4wp_connstr'] .= ' password=' . $password;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SSL parameters
|
// SSL parameters
|
||||||
if (!empty($connection->sslkey)) {
|
if (!empty($connection->sslkey)) {
|
||||||
@ -88,7 +88,7 @@ function wpsqli_real_connect(&$connection, $hostname = null, $username = null, $
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($connection->sslca)) {
|
if (!empty($connection->sslca)) {
|
||||||
$GLOBALS['pg4wp_connstr'] .= ' sslrootcert=' . $connection->sslca;
|
$GLOBALS['pg4wp_connstr'] .= ' sslrootcert=' . $connection->sslca;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($connection->sslcapath)) {
|
if (!empty($connection->sslcapath)) {
|
||||||
@ -157,7 +157,7 @@ function wpsqli_select_db(&$connection, $database)
|
|||||||
/**
|
/**
|
||||||
* Closes a previously opened database connection.
|
* Closes a previously opened database connection.
|
||||||
*
|
*
|
||||||
* This function is a wrapper for the pg_close function.
|
* This function is a wrapper for the pg_close function.
|
||||||
* // mysqli_close => pg_close (resource $connection): bool
|
* // mysqli_close => pg_close (resource $connection): bool
|
||||||
* It's important to close connections when they are no longer needed to free up resources on both the web
|
* It's important to close connections when they are no longer needed to free up resources on both the web
|
||||||
* server and the PostgreSQL server. The function returns TRUE on success or FALSE on failure.
|
* server and the PostgreSQL server. The function returns TRUE on success or FALSE on failure.
|
||||||
@ -174,7 +174,7 @@ function wpsqli_close(&$connection)
|
|||||||
/**
|
/**
|
||||||
* Used to establish secure connections using SSL.
|
* Used to establish secure connections using SSL.
|
||||||
*
|
*
|
||||||
* This function sets up variables on the fake pg connection class which are used when
|
* This function sets up variables on the fake pg connection class which are used when
|
||||||
* connecting to the postgres database with pg_connect
|
* connecting to the postgres database with pg_connect
|
||||||
*
|
*
|
||||||
* @param PgSql\Connection $connection The pg connection resource.
|
* @param PgSql\Connection $connection The pg connection resource.
|
||||||
@ -208,7 +208,7 @@ function wpsqli_ssl_set(&$connection, $key, $cert, $ca, $capath, $cipher)
|
|||||||
*/
|
*/
|
||||||
function wpsqli_get_client_info()
|
function wpsqli_get_client_info()
|
||||||
{
|
{
|
||||||
// mysqli_get_client_info => No direct equivalent.
|
// mysqli_get_client_info => No direct equivalent.
|
||||||
// Information can be derived from phpinfo() or phpversion().
|
// Information can be derived from phpinfo() or phpversion().
|
||||||
return '8.0.35'; // Just want to fool wordpress ...
|
return '8.0.35'; // Just want to fool wordpress ...
|
||||||
}
|
}
|
||||||
@ -288,8 +288,8 @@ function wpsqli_thread_id(&$connection)
|
|||||||
/**
|
/**
|
||||||
* Returns whether the client library is thread-safe.
|
* Returns whether the client library is thread-safe.
|
||||||
*
|
*
|
||||||
* This function is a wrapper for the pg_thread_safe function. It indicates whether the
|
* This function is a wrapper for the pg_thread_safe function. It indicates whether the
|
||||||
* pg client library that PHP is using is thread-safe. This is important information when
|
* pg client library that PHP is using is thread-safe. This is important information when
|
||||||
* running PHP in a multi-threaded environment such as with the worker MPM in Apache or when
|
* running PHP in a multi-threaded environment such as with the worker MPM in Apache or when
|
||||||
* using multi-threading extensions in PHP.
|
* using multi-threading extensions in PHP.
|
||||||
*
|
*
|
||||||
@ -359,9 +359,9 @@ function wpsqli_connect_errno()
|
|||||||
* Returns a string description of the last connect error.
|
* Returns a string description of the last connect error.
|
||||||
*
|
*
|
||||||
* This function is a wrapper for the pg_connect_error function. It provides a textual description
|
* This function is a wrapper for the pg_connect_error function. It provides a textual description
|
||||||
* of the error from the last connection attempt made by pg_connect() or pg_real_connect().
|
* of the error from the last connection attempt made by pg_connect() or pg_real_connect().
|
||||||
* Unlike pg_connect_errno(), which returns an error code, pg_connect_error() returns a string
|
* Unlike pg_connect_errno(), which returns an error code, pg_connect_error() returns a string
|
||||||
* describing the error. This is useful for error handling, providing more detailed context about
|
* describing the error. This is useful for error handling, providing more detailed context about
|
||||||
* connection problems.
|
* connection problems.
|
||||||
*
|
*
|
||||||
* @return string|null A string that describes the error from the last connection attempt, or NULL
|
* @return string|null A string that describes the error from the last connection attempt, or NULL
|
||||||
@ -470,7 +470,7 @@ function wpsqli_rollback(&$connection, $flags = 0, $name = null)
|
|||||||
*
|
*
|
||||||
* This function is a wrapper for the pg_query function. The pg_query function performs
|
* This function is a wrapper for the pg_query function. The pg_query function performs
|
||||||
* a query against the database and returns a result set for successful SELECT queries, or TRUE
|
* a query against the database and returns a result set for successful SELECT queries, or TRUE
|
||||||
* for other successful DML queries such as INSERT, UPDATE, DELETE, etc.
|
* for other successful DML queries such as INSERT, UPDATE, DELETE, etc.
|
||||||
*
|
*
|
||||||
* @param PgSql\Connection $connection The pg connection resource.
|
* @param PgSql\Connection $connection The pg connection resource.
|
||||||
* @param string $query The SQL query to be executed.
|
* @param string $query The SQL query to be executed.
|
||||||
@ -817,14 +817,14 @@ function wpsqli_fetch_object($result, $class = "stdClass", $constructor_args = [
|
|||||||
* Fetches one row of data from the result set and returns it as an enumerated array.
|
* Fetches one row of data from the result set and returns it as an enumerated array.
|
||||||
* Each call to this function will retrieve the next row in the result set, so it's typically
|
* Each call to this function will retrieve the next row in the result set, so it's typically
|
||||||
* used in a loop to process multiple rows.
|
* used in a loop to process multiple rows.
|
||||||
*
|
*
|
||||||
* This function is particularly useful when you need to retrieve a row as a simple array
|
* This function is particularly useful when you need to retrieve a row as a simple array
|
||||||
* where each column is accessed by an integer index starting at 0. It does not include
|
* where each column is accessed by an integer index starting at 0. It does not include
|
||||||
* column names as keys, which can be marginally faster and less memory intensive than
|
* column names as keys, which can be marginally faster and less memory intensive than
|
||||||
* associative arrays if the column names are not required.
|
* associative arrays if the column names are not required.
|
||||||
*
|
*
|
||||||
* @param \PgSql\Result $result The result set returned by a query against the database.
|
* @param \PgSql\Result $result The result set returned by a query against the database.
|
||||||
*
|
*
|
||||||
* @return array|null Returns an enumerated array of strings representing the fetched row,
|
* @return array|null Returns an enumerated array of strings representing the fetched row,
|
||||||
* or NULL if there are no more rows in the result set.
|
* or NULL if there are no more rows in the result set.
|
||||||
*/
|
*/
|
||||||
@ -838,14 +838,14 @@ function wpsqli_fetch_row($result): ?array
|
|||||||
* $result object. This function can be used in conjunction with pg_fetch_row(),
|
* $result object. This function can be used in conjunction with pg_fetch_row(),
|
||||||
* pg_fetch_assoc(), pg_fetch_array(), or pg_fetch_object() to navigate between
|
* pg_fetch_assoc(), pg_fetch_array(), or pg_fetch_object() to navigate between
|
||||||
* rows in result sets, especially when using buffered result sets.
|
* rows in result sets, especially when using buffered result sets.
|
||||||
*
|
*
|
||||||
* This is an important function for situations where you need to access a specific row
|
* This is an important function for situations where you need to access a specific row
|
||||||
* directly without iterating over all preceding rows, which can be useful for pagination
|
* directly without iterating over all preceding rows, which can be useful for pagination
|
||||||
* or when looking up specific rows by row number.
|
* or when looking up specific rows by row number.
|
||||||
*
|
*
|
||||||
* @param \PgSql\Result $result The result set returned by a query against the database.
|
* @param \PgSql\Result $result The result set returned by a query against the database.
|
||||||
* @param int $row_number The desired row number to seek to. Row numbers are zero-indexed.
|
* @param int $row_number The desired row number to seek to. Row numbers are zero-indexed.
|
||||||
*
|
*
|
||||||
* @return bool Returns TRUE on success or FALSE on failure. If the row number is out of range,
|
* @return bool Returns TRUE on success or FALSE on failure. If the row number is out of range,
|
||||||
* it returns FALSE.
|
* it returns FALSE.
|
||||||
*/
|
*/
|
||||||
|
@ -58,7 +58,7 @@ class AlterTableSQLRewriter extends AbstractSQLRewriter
|
|||||||
private function rewriteChangeColumn(string $sql): string
|
private function rewriteChangeColumn(string $sql): string
|
||||||
{
|
{
|
||||||
$pattern = '/ALTER TABLE\s+(\w+)\s+CHANGE COLUMN\s+([^\s]+)\s+([^\s]+)\s+([^ ]+)( unsigned|)\s*(NOT NULL|)\s*(default (.+)|)/';
|
$pattern = '/ALTER TABLE\s+(\w+)\s+CHANGE COLUMN\s+([^\s]+)\s+([^\s]+)\s+([^ ]+)( unsigned|)\s*(NOT NULL|)\s*(default (.+)|)/';
|
||||||
|
|
||||||
if(1 === preg_match($pattern, $sql, $matches)) {
|
if(1 === preg_match($pattern, $sql, $matches)) {
|
||||||
$table = $matches[1];
|
$table = $matches[1];
|
||||||
$col = $matches[2];
|
$col = $matches[2];
|
||||||
|
@ -30,7 +30,7 @@ class CreateTableSQLRewriter extends AbstractSQLRewriter
|
|||||||
// For flash-album-gallery plugin
|
// For flash-album-gallery plugin
|
||||||
'tinyint' => 'smallint'
|
'tinyint' => 'smallint'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function rewrite(): string
|
public function rewrite(): string
|
||||||
{
|
{
|
||||||
$sql = $this->original();
|
$sql = $this->original();
|
||||||
|
@ -99,7 +99,7 @@ class InsertSQLRewriter extends AbstractSQLRewriter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Construct the PostgreSQL ON CONFLICT DO UPDATE section
|
// Construct the PostgreSQL ON CONFLICT DO UPDATE section
|
||||||
$updateSection = implode(', ', array_map(fn($col) => "$col = EXCLUDED.$col", $updateCols));
|
$updateSection = implode(', ', array_map(fn ($col) => "$col = EXCLUDED.$col", $updateCols));
|
||||||
|
|
||||||
// Construct the PostgreSQL query
|
// Construct the PostgreSQL query
|
||||||
$postgresSQL = sprintf('%s %s ON CONFLICT (%s) DO UPDATE SET %s', $tableSection, $valuesSection, $primaryKey, $updateSection);
|
$postgresSQL = sprintf('%s %s ON CONFLICT (%s) DO UPDATE SET %s', $tableSection, $valuesSection, $primaryKey, $updateSection);
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
if (!defined('ABSPATH')) {
|
if (!defined('ABSPATH')) {
|
||||||
@ -35,10 +37,10 @@ final class parseTest extends TestCase
|
|||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$wpdb = new class() {
|
$wpdb = new class () {
|
||||||
public $options = "wp_options";
|
public $options = "wp_options";
|
||||||
public $categories = "wp_categories";
|
public $categories = "wp_categories";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
if (!defined('ABSPATH')) {
|
if (!defined('ABSPATH')) {
|
||||||
@ -31,4 +33,15 @@ final class rewriteTest extends TestCase
|
|||||||
$postgresql = pg4wp_rewrite($sql);
|
$postgresql = pg4wp_rewrite($sql);
|
||||||
$this->assertSame($postgresql, $expected);
|
$this->assertSame($postgresql, $expected);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
global $wpdb;
|
||||||
|
$wpdb = new class () {
|
||||||
|
public $categories = "wp_categories";
|
||||||
|
public $comments = "wp_comments";
|
||||||
|
public $prefix = "wp_";
|
||||||
|
public $options = "wp_options";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<?php declare(strict_types=1);
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
if (!defined('ABSPATH')) {
|
if (!defined('ABSPATH')) {
|
||||||
@ -13,7 +15,7 @@ require_once __DIR__ . "/../pg4wp/db.php";
|
|||||||
|
|
||||||
final class verifyAgainstStubsTest extends TestCase
|
final class verifyAgainstStubsTest extends TestCase
|
||||||
{
|
{
|
||||||
const STUBS_DIRECTORY = __DIR__ . '/stubs';
|
public const STUBS_DIRECTORY = __DIR__ . '/stubs';
|
||||||
|
|
||||||
public function test_verify_against_stubs()
|
public function test_verify_against_stubs()
|
||||||
{
|
{
|
||||||
@ -27,11 +29,11 @@ final class verifyAgainstStubsTest extends TestCase
|
|||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$wpdb = new class() {
|
$wpdb = new class () {
|
||||||
public $categories = "wp_categories";
|
public $categories = "wp_categories";
|
||||||
public $comments = "wp_comments";
|
public $comments = "wp_comments";
|
||||||
public $prefix = "wp_";
|
public $prefix = "wp_";
|
||||||
public $options = "wp_options";
|
public $options = "wp_options";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user