style fixes

This commit is contained in:
mattbucci
2024-01-07 23:07:50 +00:00
parent 021aa6d106
commit 94259e408b
10 changed files with 99 additions and 81 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
logs logs
.phpunit.result.cache .phpunit.result.cache
.php-cs-fixer.cache

View File

@ -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;

View File

@ -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);

View File

@ -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,7 +37,7 @@ 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";
}; };

View File

@ -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";
};
}
} }

View File

@ -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,7 +29,7 @@ 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_";