Compare commits

..

3 Commits

Author SHA1 Message Date
Clemens Schwaighofer
e2e080c404 Bug fix for DB\IO 2023-06-01 10:58:11 +09:00
Clemens Schwaighofer
4671143d1c phpunit debug fixes 2023-06-01 09:13:59 +09:00
Clemens Schwaighofer
b492558cca Logging unit test regex fix 2023-06-01 08:54:47 +09:00
3 changed files with 18 additions and 10 deletions

View File

@@ -460,16 +460,18 @@ final class CoreLibsDebugSupportTest extends TestCase
* Undocumented function * Undocumented function
* *
* @cover ::getCallerFileLine * @cover ::getCallerFileLine
* @testWith ["/storage/var/www/html/developers/clemens/core_data/php_libraries/trunk/www/vendor/phpunit/phpunit/src/Framework/TestCase.php:1608"] * @testWith ["vendor/phpunit/phpunit/src/Framework/TestCase.php:"]
* @testdox getCallerFileLine check if it returns $expected [$_dataName] * @testdox getCallerFileLine check based on regex /[\w\-\/]/vendor/phpunit/phpunit/src/Framework/TestCase.php:\d+ [$_dataName]
* *
* @param string $expected * @param string $expected
* @return void * @return void
*/ */
public function testGetCallerFileLine(string $expected): void public function testGetCallerFileLine(): void
{ {
$this->assertEquals( // regex prefix with path "/../" and then fixed vendor + \d+
$expected, $regex = "/^\/[\w\-\/]+\/vendor\/phpunit\/phpunit\/src\/Framework\/TestCase.php:\d+$/";
$this->assertMatchesRegularExpression(
$regex,
Support::getCallerFileLine() Support::getCallerFileLine()
); );
} }
@@ -518,11 +520,17 @@ final class CoreLibsDebugSupportTest extends TestCase
break; break;
case 11: case 11:
// add one "run" before "runBare" // add one "run" before "runBare"
// array_splice(
// $expected,
// 7,
// 0,
// ['run']
// );
array_splice( array_splice(
$expected, $expected,
7,
0, 0,
['run'] 0,
['include']
); );
$this->assertEquals( $this->assertEquals(
$expected, $expected,

View File

@@ -20,7 +20,7 @@ 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\.]+(:\d+)?\]\s{1}" // host:port . "\[[\w\.]+(:\d+)?\]\s{1}" // host:port
. "\[[\w+\.\/]+:\d+\]\s{1}" // folder/file . "\[[\w\-\.\/]+:\d+\]\s{1}" // folder/file
. "\[\w+\]\s{1}" // run id . "\[\w+\]\s{1}" // run id
. "{[\w\\\\]+(::\w+)?}\s{1}"; // class . "{[\w\\\\]+(::\w+)?}\s{1}"; // class

View File

@@ -382,7 +382,7 @@ class IO
/** @var array<mixed> */ /** @var array<mixed> */
private array $pk_name_table = []; private array $pk_name_table = [];
/** @var string internal primary key name, for cross calls in async */ /** @var string internal primary key name, for cross calls in async */
private string $pk_name; private string $pk_name = '';
/** @var bool if we use RETURNING in the INSERT call */ /** @var bool if we use RETURNING in the INSERT call */
private bool $returning_id = false; private bool $returning_id = false;
/** @var string if a sync is running holds the hash key of the query */ /** @var string if a sync is running holds the hash key of the query */
@@ -1267,7 +1267,7 @@ class IO
// ONLY insert with set pk name // ONLY insert with set pk name
($this->__checkQueryForInsert($this->query, true) && $this->pk_name != 'NULL') || ($this->__checkQueryForInsert($this->query, true) && $this->pk_name != 'NULL') ||
// insert or update with returning add // insert or update with returning add
($this->__checkQueryForInsert($this->query) && $this->returning_id) ($this->__checkQueryForInsert($this->query) && $this->returning_id)
) { ) {
$this->__dbSetInsertId( $this->__dbSetInsertId(
$this->returning_id, $this->returning_id,