phpunit checks and fixes

This commit is contained in:
Clemens Schwaighofer
2023-05-31 16:14:40 +09:00
parent 75c4c98de8
commit 30bb0e8895
3 changed files with 18 additions and 9 deletions

View File

@@ -67,17 +67,17 @@ final class CoreLibsGetSystemTest extends TestCase
'original set' => [ 'original set' => [
0 => null, 0 => null,
1 => 'NOHOST', 1 => 'NOHOST',
2 => 'NOPORT', 2 => 0,
], ],
'override set no port' => [ 'override set no port' => [
0 => 'foo.org', 0 => 'foo.org',
1 => 'foo.org', 1 => 'foo.org',
2 => '80' 2 => 80
], ],
'override set with port' => [ 'override set with port' => [
0 => 'foo.org:443', 0 => 'foo.org:443',
1 => 'foo.org', 1 => 'foo.org',
2 => '443' 2 => 443
] ]
]; ];
} }
@@ -138,10 +138,10 @@ final class CoreLibsGetSystemTest extends TestCase
* *
* @param string|null $input * @param string|null $input
* @param string $expected_host * @param string $expected_host
* @param string $expected_port * @param int $expected_port
* @return void * @return void
*/ */
public function testGetHostNanme(?string $input, string $expected_host, string $expected_port): void public function testGetHostNanme(?string $input, string $expected_host, int $expected_port): void
{ {
// print "HOSTNAME: " . $_SERVER['HTTP_HOST'] . "<br>"; // print "HOSTNAME: " . $_SERVER['HTTP_HOST'] . "<br>";
// print "SERVER: " . print_r($_SERVER, true) . "\n"; // print "SERVER: " . print_r($_SERVER, true) . "\n";

View File

@@ -19,10 +19,10 @@ final class CoreLibsLoggingLoggingTest extends TestCase
{ {
private const LOG_FOLDER = __DIR__ . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR; private const LOG_FOLDER = __DIR__ . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR;
private const REGEX_BASE = "\[[\d\-\s\.:]+\]\s{1}" // date private const REGEX_BASE = "\[[\d\-\s\.:]+\]\s{1}" // date
. "\[[\w\.]+:\w+\]\s{1}" // host:port . "\[[\w\.]+(:\d+)?\]\s{1}" // host:port
. "\[[\w+\.\/]+\]\s{1}" // folder/file . "\[[\w+\.\/]+:\d+\]\s{1}" // folder/file
. "\[\w+\]\s{1}" // run id . "\[\w+\]\s{1}" // run id
. "{[\w\\\\]+}\s{1}"; // class . "{[\w\\\\]+(::\w+)?}\s{1}"; // class
/** /**
* test set for options BASIC * test set for options BASIC

View File

@@ -1373,7 +1373,10 @@ class IO
*/ */
public function dbClose(): void public function dbClose(): void
{ {
if ($this->dbh) { if (
!empty($this->dbh) &&
$this->dbh instanceof \PgSql\Connection
) {
// reset any client encodings set // reset any client encodings set
$this->dbResetEncoding(); $this->dbResetEncoding();
// calls db close // calls db close
@@ -3405,6 +3408,9 @@ class IO
*/ */
public function dbGetInsertPKName(): string public function dbGetInsertPKName(): string
{ {
if (!isset($this->insert_id_pk_name)) {
return '';
}
return (string)$this->insert_id_pk_name; return (string)$this->insert_id_pk_name;
} }
@@ -3513,6 +3519,9 @@ class IO
*/ */
public function dbGetNumFields(): ?int public function dbGetNumFields(): ?int
{ {
if (!isset($this->num_fields)) {
return null;
}
return $this->num_fields; return $this->num_fields;
} }