mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
phpstan fixes
This commit is contained in:
parent
de0d70679b
commit
c77874873c
|
|
@ -62,7 +62,8 @@ final class Continuous
|
|||
*/
|
||||
public static function solve(array $items, BackpackInterface $backpack) : BackpackInterface
|
||||
{
|
||||
\usort($items, ['self', 'continuousComparator']);
|
||||
/* @phpstan-ignore-next-line */
|
||||
\usort($items, ['self', '\phpOMS\Algorithm\Knapsack\continuousComparator']);
|
||||
|
||||
$availableSpace = $backpack->getMaxCost();
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ abstract class UninstallerAbstract
|
|||
$builder = new SchemaBuilder($dbPool->get('schema'));
|
||||
|
||||
foreach ($definitions as $name => $definition) {
|
||||
$builder->dropTable($name ?? '');
|
||||
$builder->dropTable($name);
|
||||
}
|
||||
|
||||
$builder->execute();
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ class Builder extends BuilderAbstract
|
|||
/**
|
||||
* Select.
|
||||
*
|
||||
* @param array ...$columns Columns
|
||||
* @param mixed ...$columns Columns
|
||||
*
|
||||
* @return Builder
|
||||
*
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ final class HttpSession implements SessionInterface
|
|||
$this->set('CSRF', $csrf, false);
|
||||
}
|
||||
|
||||
UriFactory::setQuery('$CSRF', $csrf);
|
||||
UriFactory::setQuery('$CSRF', $csrf); /* @phpstan-ignore-line */
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -172,6 +172,8 @@ final class EigenvalueDecomposition
|
|||
|
||||
if ($scale == 0) {
|
||||
$this->E[$i] = $this->D[$i - 1];
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
for ($j = 0; $j > $i; ++$j) {
|
||||
$this->D[$j] = $this->V[$i - 1][$j];
|
||||
$this->V[$i][$j] = 0.0;
|
||||
|
|
@ -522,6 +524,7 @@ final class EigenvalueDecomposition
|
|||
$norm = 0.0;
|
||||
|
||||
for ($i = 0; $i < $nn; ++$i) {
|
||||
/* @phpstan-ignore-next-line */
|
||||
if ($i < $low || $i > $high) {
|
||||
$this->D[$i] = $this->H[$i][$i];
|
||||
$this->E[$i] = 0.0;
|
||||
|
|
@ -873,6 +876,7 @@ final class EigenvalueDecomposition
|
|||
}
|
||||
|
||||
for ($i = 0; $i < $nn; ++$i) {
|
||||
/* @phpstan-ignore-next-line */
|
||||
if ($i < $low || $i > $high) {
|
||||
for ($j = $i; $j < $nn; ++$j) {
|
||||
$this->V[$i][$j] = $this->H[$i][$j];
|
||||
|
|
|
|||
|
|
@ -548,7 +548,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
}
|
||||
}
|
||||
|
||||
$newMatrix->setMatrix($newMatrixArr);
|
||||
$newMatrix->setMatrix($newMatrixArr); /* @phpstan-ignore-line */
|
||||
|
||||
return $newMatrix;
|
||||
}
|
||||
|
|
@ -725,7 +725,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function key()
|
||||
public function key() : mixed
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
|
@ -772,7 +772,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
|
||||
$offset = (int) $offset;
|
||||
$row = (int) ($offset / $this->m);
|
||||
$this->matrix[$row][$offset - $row * $this->n] = $value;
|
||||
$this->matrix[$row][$offset - $row * $this->n] = $value; /* @phpstan-ignore-line */
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -94,20 +94,25 @@ final class ConsoleRequest extends RequestAbstract
|
|||
$key = '-' . \mb_strtolower($key);
|
||||
|
||||
if ($type === null) {
|
||||
/** @var string[] $this->data */
|
||||
/* @phpstan-ignore-next-line */
|
||||
return ArrayUtils::getArg($key, $this->data);
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'int':
|
||||
/* @phpstan-ignore-next-line */
|
||||
return (int) ArrayUtils::getArg($key, $this->data);
|
||||
case 'string':
|
||||
/* @phpstan-ignore-next-line */
|
||||
return (string) ArrayUtils::getArg($key, $this->data);
|
||||
case 'float':
|
||||
/* @phpstan-ignore-next-line */
|
||||
return (float) ArrayUtils::getArg($key, $this->data);
|
||||
case 'bool':
|
||||
/* @phpstan-ignore-next-line */
|
||||
return (bool) ArrayUtils::getArg($key, $this->data);
|
||||
default:
|
||||
/* @phpstan-ignore-next-line */
|
||||
return ArrayUtils::getArg($key, $this->data);
|
||||
}
|
||||
}
|
||||
|
|
@ -119,6 +124,7 @@ final class ConsoleRequest extends RequestAbstract
|
|||
{
|
||||
$key = '-' . \mb_strtolower($key);
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
return ArrayUtils::hasArg($key, $this->data) > -1;
|
||||
}
|
||||
|
||||
|
|
@ -136,8 +142,9 @@ final class ConsoleRequest extends RequestAbstract
|
|||
public function setData(string $key, mixed $value, bool $overwrite = false) : bool
|
||||
{
|
||||
$key = '-' . \mb_strtolower($key);
|
||||
|
||||
$pos = -1;
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
if ($overwrite || ($pos = ArrayUtils::hasArg($key, $this->data)) !== -1) {
|
||||
if ($pos === -1) {
|
||||
$this->data[] = $key;
|
||||
|
|
|
|||
|
|
@ -82,12 +82,15 @@ final class Rest
|
|||
// handle different content types
|
||||
$contentType = $requestHeaders['content-type'] ?? [];
|
||||
if ($request->getData() !== null && (empty($contentType) || \in_array(MimeType::M_POST, $contentType))) {
|
||||
/* @phpstan-ignore-next-line */
|
||||
\curl_setopt($curl, \CURLOPT_POSTFIELDS, \http_build_query($request->getData()));
|
||||
} elseif ($request->getData() !== null && \in_array(MimeType::M_JSON, $contentType)) {
|
||||
\curl_setopt($curl, \CURLOPT_POSTFIELDS, \json_encode($request->getData()));
|
||||
} elseif ($request->getData() !== null && \in_array(MimeType::M_MULT, $contentType)) {
|
||||
$boundary = '----' . \uniqid();
|
||||
$data = self::createMultipartData($boundary, $request->getData());
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
$data = self::createMultipartData($boundary, $request->getData());
|
||||
|
||||
// @todo: replace boundary/ with the correct boundary= in the future.
|
||||
// Currently this cannot be done due to a bug. If we do it now the server cannot correclty populate php://input
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ abstract class RequestAbstract implements MessageInterface
|
|||
return [];
|
||||
}
|
||||
|
||||
$json = \json_decode($this->data[$key], true);
|
||||
$json = \json_decode($this->data[$key], true); /** @phpstan-ignore-line */
|
||||
|
||||
return !\is_array($json) ? [] : $json;
|
||||
}
|
||||
|
|
@ -154,6 +154,7 @@ abstract class RequestAbstract implements MessageInterface
|
|||
return [];
|
||||
}
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
$list = \explode($delim, $this->data[$key]);
|
||||
|
||||
if ($list === false) {
|
||||
|
|
|
|||
|
|
@ -676,6 +676,7 @@ final class ModuleManager
|
|||
$this->initModule($module, $appName);
|
||||
}
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
return $this->running[$name] ?? new NullModule();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class Address implements \JsonSerializable
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize(int $option = 0)
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -330,6 +330,6 @@ class PriorityQueue implements \Countable, SerializableInterface
|
|||
*/
|
||||
public function unserialize(mixed $data) : void
|
||||
{
|
||||
$this->queue = \json_decode($data, true);
|
||||
$this->queue = \json_decode($data, true); /* @phpstan-ignore-line */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private string $filter = '*';
|
||||
//private string $filter = '*';
|
||||
|
||||
/**
|
||||
* Directory nodes (files and directories).
|
||||
|
|
@ -79,21 +79,20 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
* Constructor.
|
||||
*
|
||||
* @param HttpUri $uri Uri
|
||||
* @param string $filter Filter
|
||||
* @param bool $initialize Should get initialized during construction
|
||||
* @param \FTP\Connection $con Connection
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(HttpUri $uri, string $filter = '*', bool $initialize = true, \FTP\Connection $con = null)
|
||||
public function __construct(HttpUri $uri, bool $initialize = true, \FTP\Connection $con = null)
|
||||
{
|
||||
$this->uri = $uri;
|
||||
$this->con = $con ?? self::ftpConnect($uri);
|
||||
|
||||
$this->filter = \ltrim($filter, '\\/');
|
||||
//$this->filter = \ltrim($filter, '\\/');
|
||||
parent::__construct($uri->getPath());
|
||||
|
||||
if ($initialize && self::exists($this->con, $this->path)) {
|
||||
if ($initialize && $this->con !== null && self::exists($this->con, $this->path)) {
|
||||
$this->index();
|
||||
}
|
||||
}
|
||||
|
|
@ -110,6 +109,10 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
$this->isInitialized = true;
|
||||
parent::index();
|
||||
|
||||
if ($this->con === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$list = self::list($this->con, $this->path);
|
||||
|
||||
foreach ($list as $filename) {
|
||||
|
|
@ -117,7 +120,7 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
$uri = clone $this->uri;
|
||||
$uri->setPath($filename);
|
||||
|
||||
$file = \ftp_size($this->con, $filename) === -1 ? new self($uri, '*', false, $this->con) : new File($uri, $this->con);
|
||||
$file = \ftp_size($this->con, $filename) === -1 ? new self($uri, false, $this->con) : new File($uri, $this->con);
|
||||
|
||||
$this->addNode($file);
|
||||
}
|
||||
|
|
@ -604,6 +607,10 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
*/
|
||||
public function createNode() : bool
|
||||
{
|
||||
if ($this->con === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return self::create($this->con, $this->path, $this->permission, true);
|
||||
}
|
||||
|
||||
|
|
@ -629,10 +636,7 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
$uri = clone $this->uri;
|
||||
$uri->setPath(self::parent($this->path));
|
||||
|
||||
return new self(
|
||||
$uri,
|
||||
'*', true, $this->con
|
||||
);
|
||||
return new self($uri, true, $this->con);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -640,6 +644,10 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
*/
|
||||
public function copyNode(string $to, bool $overwrite = false) : bool
|
||||
{
|
||||
if ($this->con === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return self::copy($this->con, $this->path, $to, $overwrite);
|
||||
}
|
||||
|
||||
|
|
@ -648,6 +656,10 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
*/
|
||||
public function moveNode(string $to, bool $overwrite = false) : bool
|
||||
{
|
||||
if ($this->con === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return self::move($this->con, $this->path, $to, $overwrite);
|
||||
}
|
||||
|
||||
|
|
@ -656,6 +668,10 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
*/
|
||||
public function deleteNode() : bool
|
||||
{
|
||||
if ($this->con === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// @todo: update parent
|
||||
|
||||
return self::delete($this->con, $this->path);
|
||||
|
|
@ -716,6 +732,7 @@ class Directory extends FileAbstract implements DirectoryInterface
|
|||
*/
|
||||
public function offsetSet(mixed $offset, mixed $value) : void
|
||||
{
|
||||
/** @var \phpOMS\System\File\ContainerInterface $value */
|
||||
if ($offset === null || !isset($this->nodes[$offset])) {
|
||||
$this->addNode($value);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class File extends FileAbstract implements FileInterface
|
|||
|
||||
parent::__construct($uri->getPath());
|
||||
|
||||
if (self::exists($this->con, $this->path)) {
|
||||
if ($this->con !== null && self::exists($this->con, $this->path)) {
|
||||
$this->index();
|
||||
}
|
||||
}
|
||||
|
|
@ -63,6 +63,10 @@ class File extends FileAbstract implements FileInterface
|
|||
{
|
||||
parent::index();
|
||||
|
||||
if ($this->con === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->size = (int) \ftp_size($this->con, $this->path);
|
||||
}
|
||||
|
||||
|
|
@ -408,6 +412,10 @@ class File extends FileAbstract implements FileInterface
|
|||
*/
|
||||
public function isExisting() : bool
|
||||
{
|
||||
if ($this->con === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return self::exists($this->con, $this->path);
|
||||
}
|
||||
|
||||
|
|
@ -425,7 +433,7 @@ class File extends FileAbstract implements FileInterface
|
|||
$uri = clone $this->uri;
|
||||
$uri->setPath(self::parent($this->path));
|
||||
|
||||
return new Directory($uri, '*', true, $this->con);
|
||||
return new Directory($uri, true, $this->con);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -437,6 +445,10 @@ class File extends FileAbstract implements FileInterface
|
|||
*/
|
||||
public function createNode() : bool
|
||||
{
|
||||
if ($this->con === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return self::create($this->con, $this->uri->getPath());
|
||||
}
|
||||
|
||||
|
|
@ -452,6 +464,10 @@ class File extends FileAbstract implements FileInterface
|
|||
*/
|
||||
public function copyNode(string $to, bool $overwrite = false) : bool
|
||||
{
|
||||
if ($this->con === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return self::copy($this->con, $this->path, $to, $overwrite);
|
||||
}
|
||||
|
||||
|
|
@ -467,6 +483,10 @@ class File extends FileAbstract implements FileInterface
|
|||
*/
|
||||
public function moveNode(string $to, bool $overwrite = false) : bool
|
||||
{
|
||||
if ($this->con === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return self::move($this->con, $this->path, $to, $overwrite);
|
||||
}
|
||||
|
||||
|
|
@ -479,6 +499,10 @@ class File extends FileAbstract implements FileInterface
|
|||
*/
|
||||
public function deleteNode() : bool
|
||||
{
|
||||
if ($this->con === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return self::delete($this->con, $this->path);
|
||||
}
|
||||
|
||||
|
|
@ -494,6 +518,10 @@ class File extends FileAbstract implements FileInterface
|
|||
*/
|
||||
public function putContent(string $content, int $mode = ContentPutMode::APPEND | ContentPutMode::CREATE) : bool
|
||||
{
|
||||
if ($this->con === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return self::put($this->con, $this->path, $content, $mode);
|
||||
}
|
||||
|
||||
|
|
@ -554,6 +582,10 @@ class File extends FileAbstract implements FileInterface
|
|||
*/
|
||||
public function getContent() : string
|
||||
{
|
||||
if ($this->con === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return self::get($this->con, $this->path);
|
||||
}
|
||||
|
||||
|
|
@ -611,6 +643,6 @@ class File extends FileAbstract implements FileInterface
|
|||
$uri = clone $this->uri;
|
||||
$uri->setPath(self::dirpath($this->path));
|
||||
|
||||
return new Directory($uri, '*', true, $this->con);
|
||||
return new Directory($uri, true, $this->con);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ abstract class FileAbstract implements FtpContainerInterface
|
|||
/**
|
||||
* Ftp connection
|
||||
*
|
||||
* @var \FTP\Connection
|
||||
* @var null|\FTP\Connection
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected \FTP\Connection $con;
|
||||
protected ?\FTP\Connection $con = null;
|
||||
|
||||
/**
|
||||
* Ftp uri
|
||||
|
|
@ -209,6 +209,10 @@ abstract class FileAbstract implements FtpContainerInterface
|
|||
*/
|
||||
public function index() : void
|
||||
{
|
||||
if ($this->con === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$mtime = \ftp_mdtm($this->con, $this->path);
|
||||
$ctime = \ftp_mdtm($this->con, $this->path);
|
||||
|
||||
|
|
|
|||
|
|
@ -576,7 +576,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testList() : void
|
||||
{
|
||||
$dirTestPath = __DIR__ . '/dirtest';
|
||||
$dir = new Directory(new HttpUri(self::BASE . $dirTestPath), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . $dirTestPath), true, self::$con);
|
||||
|
||||
self::assertEquals([
|
||||
'sub',
|
||||
|
|
@ -591,7 +591,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testNodeOutput() : void
|
||||
{
|
||||
$dirTestPath = __DIR__ . '/dirtest';
|
||||
$dir = new Directory(new HttpUri(self::BASE . $dirTestPath), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . $dirTestPath), true, self::$con);
|
||||
|
||||
self::assertInstanceOf(Directory::class, $dir->getNode('sub'));
|
||||
}
|
||||
|
|
@ -602,13 +602,13 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeCreate() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
|
||||
$dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir')));
|
||||
|
||||
self::assertTrue(\is_dir(__DIR__ . '/nodedir'));
|
||||
\rmdir(__DIR__ . '/nodedir');
|
||||
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir2'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir2'), true, self::$con);
|
||||
$dir->createNode();
|
||||
|
||||
self::assertTrue(\is_dir(__DIR__ . '/nodedir2'));
|
||||
|
|
@ -621,7 +621,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeDelete() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
|
||||
$dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir')));
|
||||
|
||||
self::assertTrue(\is_dir(__DIR__ . '/nodedir'));
|
||||
|
|
@ -637,7 +637,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeCopy() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
|
||||
$dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir')));
|
||||
|
||||
$dir->getNode('nodedir')->copyNode(__DIR__ . '/nodedir2');
|
||||
|
|
@ -653,7 +653,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeMove() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
|
||||
$dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir')));
|
||||
|
||||
$dir->getNode('nodedir')->moveNode(__DIR__ . '/nodedir2');
|
||||
|
|
@ -669,7 +669,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeExists() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
|
||||
|
||||
self::assertTrue($dir->isExisting());
|
||||
self::assertTrue($dir->isExisting('dirtest'));
|
||||
|
|
@ -682,7 +682,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testParentOutput() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
|
||||
|
||||
self::assertEquals(__DIR__, $dir->getParent()->getPath());
|
||||
}
|
||||
|
|
@ -693,7 +693,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeNext() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals(__DIR__ . '/dirtest/test.txt', $dir->current()->getPath());
|
||||
|
|
@ -705,7 +705,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeCurrent() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
|
||||
|
||||
self::assertEquals(__DIR__ . '/dirtest/sub', $dir->current()->getPath());
|
||||
}
|
||||
|
|
@ -716,7 +716,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeKey() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
|
||||
|
||||
self::assertEquals('sub', $dir->key());
|
||||
|
||||
|
|
@ -730,7 +730,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeArrayRead() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
|
||||
|
||||
self::assertEquals('test', $dir['test.txt']->getName());
|
||||
}
|
||||
|
|
@ -741,7 +741,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeArraySet() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
|
||||
$dir[] = new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir'));
|
||||
|
||||
self::assertTrue(\is_dir(__DIR__ . '/nodedir'));
|
||||
|
|
@ -759,7 +759,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeArrayRemove() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
|
||||
$dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir')));
|
||||
|
||||
self::assertTrue(\is_dir(__DIR__ . '/nodedir'));
|
||||
|
|
@ -775,7 +775,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeArrayExists() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
|
||||
|
||||
self::assertTrue(isset($dir['dirtest']));
|
||||
self::assertFalse(isset($dir['invalid']));
|
||||
|
|
@ -788,7 +788,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testNodeCreatedAt() : void
|
||||
{
|
||||
$dirPath = __DIR__ . '/test';
|
||||
$dir = new Directory(new HttpUri(self::BASE . $dirPath), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . $dirPath), true, self::$con);
|
||||
|
||||
self::assertTrue($dir->createNode());
|
||||
|
||||
|
|
@ -805,7 +805,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
public function testNodeChangedAt() : void
|
||||
{
|
||||
$dirPath = __DIR__ . '/test';
|
||||
$dir = new Directory(new HttpUri(self::BASE . $dirPath), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . $dirPath), true, self::$con);
|
||||
|
||||
self::assertTrue($dir->createNode());
|
||||
|
||||
|
|
@ -821,7 +821,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeOwner() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
|
||||
|
||||
self::assertNotEmpty($dir->getOwner());
|
||||
}
|
||||
|
|
@ -832,7 +832,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodePermission() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
|
||||
|
||||
self::assertGreaterThan(0, $dir->getPermission());
|
||||
}
|
||||
|
|
@ -843,7 +843,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testDirname() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals('dirtest', $dir->current()->getDirname());
|
||||
|
|
@ -855,7 +855,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testName() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals('test', $dir->current()->getName());
|
||||
|
|
@ -867,7 +867,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testBaseame() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals('test.txt', $dir->current()->getBasename());
|
||||
|
|
@ -879,7 +879,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testDirpath() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
|
||||
$dir->next();
|
||||
|
||||
self::assertEquals(__DIR__ . '/dirtest', $dir->current()->getDirPath());
|
||||
|
|
@ -891,7 +891,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeValid() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
|
||||
$dir->next();
|
||||
|
||||
self::assertTrue($dir->valid());
|
||||
|
|
@ -903,7 +903,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testNodeInvalid() : void
|
||||
{
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con);
|
||||
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
|
||||
|
||||
while ($dir->valid()) {
|
||||
$dir->next();
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<exclude>./vendor</exclude>
|
||||
<exclude>./Build</exclude>
|
||||
<exclude>./Resources</exclude>
|
||||
<exclude>./Application/Testapp*</exclude>
|
||||
<exclude>*Testapp*</exclude>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<groups>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user