mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-10 05:58:42 +00:00
fix tests
This commit is contained in:
parent
7882ce95be
commit
eddc7bff03
|
|
@ -301,7 +301,7 @@ final class FileCache extends ConnectionAbstract
|
||||||
$cacheExpire = \substr($raw, $expireStart + 1, $expireEnd - ($expireStart + 1));
|
$cacheExpire = \substr($raw, $expireStart + 1, $expireEnd - ($expireStart + 1));
|
||||||
$cacheExpire = ($cacheExpire === -1) ? $created : (int) $cacheExpire;
|
$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);
|
$this->delete($key);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -435,7 +435,6 @@ final class FileCache extends ConnectionAbstract
|
||||||
return false; // @codeCoverageIgnore
|
return false; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = (int) $raw[0];
|
|
||||||
$expireStart = (int) \strpos($raw, self::DELIM);
|
$expireStart = (int) \strpos($raw, self::DELIM);
|
||||||
$expireEnd = (int) \strpos($raw, self::DELIM, $expireStart + 1);
|
$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 = \substr($raw, $expireStart + 1, $expireEnd - ($expireStart + 1));
|
||||||
$cacheExpire = ($cacheExpire === -1) ? $created : (int) $cacheExpire;
|
$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);
|
File::delete($path);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -470,7 +469,6 @@ final class FileCache extends ConnectionAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$created = File::created($path)->getTimestamp();
|
$created = File::created($path)->getTimestamp();
|
||||||
$now = \time();
|
|
||||||
|
|
||||||
$raw = \file_get_contents($path);
|
$raw = \file_get_contents($path);
|
||||||
if ($raw === false) {
|
if ($raw === false) {
|
||||||
|
|
@ -509,7 +507,6 @@ final class FileCache extends ConnectionAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$created = File::created($path)->getTimestamp();
|
$created = File::created($path)->getTimestamp();
|
||||||
$now = \time();
|
|
||||||
|
|
||||||
$raw = \file_get_contents($path);
|
$raw = \file_get_contents($path);
|
||||||
if ($raw === false) {
|
if ($raw === false) {
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,7 @@ final class LUDecomposition
|
||||||
$this->piv[$i] = $i;
|
$this->piv[$i] = $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->pivSign = 1;
|
$LUrowi = $LUcolj = [];
|
||||||
$LUrowi = $LUcolj = [];
|
|
||||||
|
|
||||||
for ($j = 0; $j < $this->n; ++$j) {
|
for ($j = 0; $j < $this->n; ++$j) {
|
||||||
for ($i = 0; $i < $this->m; ++$i) {
|
for ($i = 0; $i < $this->m; ++$i) {
|
||||||
|
|
|
||||||
|
|
@ -153,10 +153,7 @@ final class CliHeader extends HeaderAbstract
|
||||||
*/
|
*/
|
||||||
public function generate(int $code) : void
|
public function generate(int $code) : void
|
||||||
{
|
{
|
||||||
switch ($code) {
|
exit($code);
|
||||||
default:
|
|
||||||
$this->generate500();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -166,15 +163,4 @@ final class CliHeader extends HeaderAbstract
|
||||||
{
|
{
|
||||||
return $this->timestamp;
|
return $this->timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate predefined header.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private function generate500() : void
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase
|
||||||
\copy(__DIR__ . '/backup.db', __DIR__ . '/spreadsheet.db');
|
\copy(__DIR__ . '/backup.db', __DIR__ . '/spreadsheet.db');
|
||||||
|
|
||||||
$this->sqlite = new SQLiteConnection(['db' => 'sqlite', 'database' => __DIR__ . '/spreadsheet.db']);
|
$this->sqlite = new SQLiteConnection(['db' => 'sqlite', 'database' => __DIR__ . '/spreadsheet.db']);
|
||||||
|
$this->sqlite->connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown() : void
|
protected function tearDown() : void
|
||||||
|
|
@ -62,6 +63,8 @@ final class SpreadsheetDatabaseMapperTest extends \PHPUnit\Framework\TestCase
|
||||||
if (\is_file(__DIR__ . '/spreadsheet.db')) {
|
if (\is_file(__DIR__ . '/spreadsheet.db')) {
|
||||||
\unlink(__DIR__ . '/spreadsheet.db');
|
\unlink(__DIR__ . '/spreadsheet.db');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->sqlite->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user