fix tests

This commit is contained in:
Dennis Eichhorn 2023-09-21 15:54:06 +00:00
parent 7882ce95be
commit eddc7bff03
4 changed files with 7 additions and 22 deletions

View File

@ -301,7 +301,7 @@ final class FileCache extends ConnectionAbstract
$cacheExpire = \substr($raw, $expireStart + 1, $expireEnd - ($expireStart + 1));
$cacheExpire = ($cacheExpire === -1) ? $created : (int) $cacheExpire;
if ($cacheExpire >= 0 && $created + $cacheExpire + ($expire > 0 ? $expire : 0) < $now) {
if ($cacheExpire >= 0 && $created + $cacheExpire + \max(0, $expire) < $now) {
$this->delete($key);
return null;
@ -435,7 +435,6 @@ final class FileCache extends ConnectionAbstract
return false; // @codeCoverageIgnore
}
$type = (int) $raw[0];
$expireStart = (int) \strpos($raw, self::DELIM);
$expireEnd = (int) \strpos($raw, self::DELIM, $expireStart + 1);
@ -446,7 +445,7 @@ final class FileCache extends ConnectionAbstract
$cacheExpire = \substr($raw, $expireStart + 1, $expireEnd - ($expireStart + 1));
$cacheExpire = ($cacheExpire === -1) ? $created : (int) $cacheExpire;
if ($cacheExpire >= 0 && $created + $cacheExpire + ($expire > 0 ? $expire : 0) < $now) {
if ($cacheExpire >= 0 && $created + $cacheExpire + \max(0, $expire) < $now) {
File::delete($path);
return false;
@ -470,7 +469,6 @@ final class FileCache extends ConnectionAbstract
}
$created = File::created($path)->getTimestamp();
$now = \time();
$raw = \file_get_contents($path);
if ($raw === false) {
@ -509,7 +507,6 @@ final class FileCache extends ConnectionAbstract
}
$created = File::created($path)->getTimestamp();
$now = \time();
$raw = \file_get_contents($path);
if ($raw === false) {

View File

@ -86,8 +86,7 @@ final class LUDecomposition
$this->piv[$i] = $i;
}
$this->pivSign = 1;
$LUrowi = $LUcolj = [];
$LUrowi = $LUcolj = [];
for ($j = 0; $j < $this->n; ++$j) {
for ($i = 0; $i < $this->m; ++$i) {

View File

@ -153,10 +153,7 @@ final class CliHeader extends HeaderAbstract
*/
public function generate(int $code) : void
{
switch ($code) {
default:
$this->generate500();
}
exit($code);
}
/**
@ -166,15 +163,4 @@ final class CliHeader extends HeaderAbstract
{
return $this->timestamp;
}
/**
* Generate predefined header.
*
* @return void
*
* @since 1.0.0
*/
private function generate500() : void
{
}
}

View File

@ -55,6 +55,7 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase
\copy(__DIR__ . '/backup.db', __DIR__ . '/spreadsheet.db');
$this->sqlite = new SQLiteConnection(['db' => 'sqlite', 'database' => __DIR__ . '/spreadsheet.db']);
$this->sqlite->connect();
}
protected function tearDown() : void
@ -62,6 +63,8 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase
if (\is_file(__DIR__ . '/spreadsheet.db')) {
\unlink(__DIR__ . '/spreadsheet.db');
}
$this->sqlite->close();
}
/**