mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
run php-cs-fixer
This commit is contained in:
parent
de8e83ce7e
commit
2842dffb51
41 changed files with 151 additions and 141 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,3 +1,5 @@
|
|||
.idea
|
||||
vendor
|
||||
composer.lock
|
||||
.php_cs.cache
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace Icewind\SMB;
|
||||
|
||||
|
||||
abstract class AbstractServer implements IServer {
|
||||
const LOCALE = 'en_US.UTF-8';
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ abstract class AbstractShare implements IShare {
|
|||
private $forbiddenCharacters;
|
||||
|
||||
public function __construct() {
|
||||
$this->forbiddenCharacters = array('?', '<', '>', ':', '*', '|', '"', chr(0), "\n", "\r");
|
||||
$this->forbiddenCharacters = ['?', '<', '>', ':', '*', '|', '"', chr(0), "\n", "\r"];
|
||||
}
|
||||
|
||||
protected function verifyPath($path) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace Icewind\SMB;
|
||||
|
||||
|
||||
class AnonymousAuth implements IAuth {
|
||||
public function getUsername() {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace Icewind\SMB;
|
||||
|
||||
|
||||
class BasicAuth implements IAuth {
|
||||
/** @var string */
|
||||
private $username;
|
||||
|
|
@ -62,5 +61,4 @@ class BasicAuth implements IAuth {
|
|||
public function setExtraSmbClientOptions($smbClientState) {
|
||||
// noop
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class AccessDeniedException extends ConnectException {}
|
||||
class AccessDeniedException extends ConnectException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class AlreadyExistsException extends InvalidRequestException {}
|
||||
class AlreadyExistsException extends InvalidRequestException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class AuthenticationException extends ConnectException{}
|
||||
class AuthenticationException extends ConnectException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class ConnectException extends Exception {}
|
||||
class ConnectException extends Exception {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class ConnectionException extends ConnectException {}
|
||||
class ConnectionException extends ConnectException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class Exception extends \Exception {
|
||||
static public function unknown($path, $error) {
|
||||
public static function unknown($path, $error) {
|
||||
$message = 'Unknown error (' . $error . ')';
|
||||
if ($path) {
|
||||
$message .= ' for ' . $path;
|
||||
|
|
@ -23,7 +23,7 @@ class Exception extends \Exception {
|
|||
* @param string $path
|
||||
* @return Exception
|
||||
*/
|
||||
static public function fromMap(array $exceptionMap, $error, $path) {
|
||||
public static function fromMap(array $exceptionMap, $error, $path) {
|
||||
if (isset($exceptionMap[$error])) {
|
||||
$exceptionClass = $exceptionMap[$error];
|
||||
if (is_numeric($error)) {
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class FileInUseException extends InvalidRequestException {}
|
||||
class FileInUseException extends InvalidRequestException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class ForbiddenException extends InvalidRequestException {}
|
||||
class ForbiddenException extends InvalidRequestException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class InvalidArgumentException extends InvalidRequestException {}
|
||||
class InvalidArgumentException extends InvalidRequestException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class InvalidHostException extends ConnectException {}
|
||||
class InvalidHostException extends ConnectException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class InvalidParameterException extends InvalidRequestException {}
|
||||
class InvalidParameterException extends InvalidRequestException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class InvalidPathException extends InvalidRequestException {}
|
||||
class InvalidPathException extends InvalidRequestException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class InvalidTypeException extends InvalidRequestException {}
|
||||
class InvalidTypeException extends InvalidRequestException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class NoLoginServerException extends ConnectException {}
|
||||
class NoLoginServerException extends ConnectException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class NotEmptyException extends InvalidRequestException {}
|
||||
class NotEmptyException extends InvalidRequestException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@
|
|||
|
||||
namespace Icewind\SMB\Exception;
|
||||
|
||||
class NotFoundException extends InvalidRequestException {}
|
||||
class NotFoundException extends InvalidRequestException {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
namespace Icewind\SMB;
|
||||
|
||||
|
||||
interface INotifyHandler {
|
||||
// https://msdn.microsoft.com/en-us/library/dn392331.aspx
|
||||
const NOTIFY_ADDED = 1;
|
||||
|
|
|
|||
|
|
@ -45,5 +45,4 @@ class KerberosAuth implements IAuth {
|
|||
smbclient_option_set($smbClientState, SMBCLIENT_OPT_USE_KERBEROS, true);
|
||||
smbclient_option_set($smbClientState, SMBCLIENT_OPT_FALLBACK_AFTER_KERBEROS, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ class NativeReadStream extends NativeStream {
|
|||
$this->readBuffer = fopen('php://memory', 'r+');
|
||||
|
||||
return parent::stream_open($path, $mode, $options, $opened_path);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -39,13 +38,13 @@ class NativeReadStream extends NativeStream {
|
|||
*/
|
||||
public static function wrap($state, $smbStream, $mode, $url) {
|
||||
stream_wrapper_register('nativesmb', NativeReadStream::class);
|
||||
$context = stream_context_create(array(
|
||||
'nativesmb' => array(
|
||||
$context = stream_context_create([
|
||||
'nativesmb' => [
|
||||
'state' => $state,
|
||||
'handle' => $smbStream,
|
||||
'url' => $url
|
||||
)
|
||||
));
|
||||
]
|
||||
]);
|
||||
$fh = fopen('nativesmb://', $mode, false, $context);
|
||||
stream_wrapper_unregister('nativesmb');
|
||||
return $fh;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class NativeServer extends AbstractServer {
|
|||
*/
|
||||
public function listShares() {
|
||||
$this->connect();
|
||||
$shares = array();
|
||||
$shares = [];
|
||||
$dh = $this->state->opendir('smb://' . $this->getHost());
|
||||
while ($share = $this->state->readdir($dh)) {
|
||||
if ($share['type'] === 'file share') {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class NativeShare extends AbstractShare {
|
|||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||
*/
|
||||
public function dir($path) {
|
||||
$files = array();
|
||||
$files = [];
|
||||
|
||||
$dh = $this->getState()->opendir($this->buildUrl($path));
|
||||
while ($file = $this->getState()->readdir($dh)) {
|
||||
|
|
@ -277,7 +277,6 @@ class NativeShare extends AbstractShare {
|
|||
* @return string the attribute value
|
||||
*/
|
||||
public function setAttribute($path, $attribute, $value) {
|
||||
|
||||
if ($attribute === 'system.dos_attr.mode' and is_int($value)) {
|
||||
$value = '0x' . dechex($value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@ class NativeStream implements File {
|
|||
*/
|
||||
public static function wrap($state, $smbStream, $mode, $url) {
|
||||
stream_wrapper_register('nativesmb', NativeStream::class);
|
||||
$context = stream_context_create(array(
|
||||
'nativesmb' => array(
|
||||
$context = stream_context_create([
|
||||
'nativesmb' => [
|
||||
'state' => $state,
|
||||
'handle' => $smbStream,
|
||||
'url' => $url
|
||||
)
|
||||
));
|
||||
]
|
||||
]);
|
||||
$fh = fopen('nativesmb://', $mode, false, $context);
|
||||
stream_wrapper_unregister('nativesmb');
|
||||
return $fh;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ class NativeWriteStream extends NativeStream {
|
|||
$this->writeBuffer = fopen('php://memory', 'r+');
|
||||
|
||||
return parent::stream_open($path, $mode, $options, $opened_path);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -39,13 +38,13 @@ class NativeWriteStream extends NativeStream {
|
|||
*/
|
||||
public static function wrap($state, $smbStream, $mode, $url) {
|
||||
stream_wrapper_register('nativesmb', NativeWriteStream::class);
|
||||
$context = stream_context_create(array(
|
||||
'nativesmb' => array(
|
||||
$context = stream_context_create([
|
||||
'nativesmb' => [
|
||||
'state' => $state,
|
||||
'handle' => $smbStream,
|
||||
'url' => $url
|
||||
)
|
||||
));
|
||||
]
|
||||
]);
|
||||
$fh = fopen('nativesmb://', $mode, false, $context);
|
||||
stream_wrapper_unregister('nativesmb');
|
||||
return $fh;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace Icewind\SMB;
|
||||
|
||||
|
||||
class Options implements IOptions {
|
||||
/** @var int */
|
||||
private $timeout = 20;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace Icewind\SMB;
|
||||
|
||||
|
||||
use Icewind\SMB\Exception\DependencyException;
|
||||
use Icewind\SMB\Native\NativeServer;
|
||||
use Icewind\SMB\Wrapped\Server;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class System implements ISystem {
|
|||
protected function getBinaryPath($binary) {
|
||||
if (!isset($this->paths[$binary])) {
|
||||
$result = null;
|
||||
$output = array();
|
||||
$output = [];
|
||||
exec("which $binary 2>&1", $output, $result);
|
||||
$this->paths[$binary] = $result === 0 ? trim(implode('', $output)) : false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ class TimeZoneProvider implements ITimeZoneProvider {
|
|||
$net = $this->system->getNetPath();
|
||||
// for local domain names we can assume same timezone
|
||||
if ($net && $host && strpos($host, '.') !== false) {
|
||||
$command = sprintf('%s time zone -S %s',
|
||||
$command = sprintf(
|
||||
'%s time zone -S %s',
|
||||
$net,
|
||||
escapeshellarg($host)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class Connection extends RawConnection {
|
|||
/** @var Parser */
|
||||
private $parser;
|
||||
|
||||
public function __construct($command, Parser $parser, $env = array()) {
|
||||
public function __construct($command, Parser $parser, $env = []) {
|
||||
parent::__construct($command, $env);
|
||||
$this->parser = $parser;
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ class Connection extends RawConnection {
|
|||
$promptLine = $this->readLine(); //first line is prompt
|
||||
$this->parser->checkConnectionError($promptLine);
|
||||
|
||||
$output = array();
|
||||
$output = [];
|
||||
$line = $this->readLine();
|
||||
if ($line === false) {
|
||||
$this->unknownError($promptLine);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
namespace Icewind\SMB\Wrapped;
|
||||
|
||||
|
||||
use Icewind\SMB\Change;
|
||||
use Icewind\SMB\Exception\Exception;
|
||||
use Icewind\SMB\Exception\RevisionMismatchException;
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ class Parser {
|
|||
$value = trim($value);
|
||||
|
||||
if (!isset($data[$name])) {
|
||||
$data[$name] = $value;
|
||||
$data[$name] = $value;
|
||||
}
|
||||
}
|
||||
return [
|
||||
|
|
@ -156,7 +156,7 @@ class Parser {
|
|||
array_pop($output);
|
||||
$regex = '/^\s*(.*?)\s\s\s\s+(?:([NDHARS]*)\s+)?([0-9]+)\s+(.*)$/';
|
||||
//2 spaces, filename, optional type, size, date
|
||||
$content = array();
|
||||
$content = [];
|
||||
foreach ($output as $line) {
|
||||
if (preg_match($regex, $line, $matches)) {
|
||||
list(, $name, $mode, $size, $time) = $matches;
|
||||
|
|
@ -171,14 +171,14 @@ class Parser {
|
|||
}
|
||||
|
||||
public function parseListShares($output) {
|
||||
$shareNames = array();
|
||||
$shareNames = [];
|
||||
foreach ($output as $line) {
|
||||
if (strpos($line, '|')) {
|
||||
list($type, $name, $description) = explode('|', $line);
|
||||
if (strtolower($type) === 'disk') {
|
||||
$shareNames[$name] = $description;
|
||||
}
|
||||
} else if (strpos($line, 'Disk')) {
|
||||
} elseif (strpos($line, 'Disk')) {
|
||||
// new output format
|
||||
list($name, $description) = explode('Disk', $line);
|
||||
$shareNames[trim($name)] = trim($description);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ class Server extends AbstractServer {
|
|||
* @throws ConnectException
|
||||
*/
|
||||
public function listShares() {
|
||||
$command = sprintf('%s %s %s -L %s',
|
||||
$command = sprintf(
|
||||
'%s %s %s -L %s',
|
||||
$this->system->getSmbclientPath(),
|
||||
$this->getAuthFileArgument(),
|
||||
$this->getAuth()->getExtraCommandLineArguments(),
|
||||
|
|
@ -73,7 +74,7 @@ class Server extends AbstractServer {
|
|||
|
||||
$shareNames = $parser->parseListShares($output);
|
||||
|
||||
$shares = array();
|
||||
$shares = [];
|
||||
foreach ($shareNames as $name => $description) {
|
||||
$shares[] = $this->getShare($name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ class Share extends AbstractShare {
|
|||
}
|
||||
|
||||
protected function getConnection() {
|
||||
$command = sprintf('%s%s -t %s %s %s %s',
|
||||
$command = sprintf(
|
||||
'%s%s -t %s %s %s %s',
|
||||
$this->system->getStdBufPath() ? $this->system->getStdBufPath() . ' -o0 ' : '',
|
||||
$this->system->getSmbclientPath(),
|
||||
$this->server->getOptions()->getTimeout(),
|
||||
|
|
@ -159,7 +160,7 @@ class Share extends AbstractShare {
|
|||
if ($path !== "" && $path !== "/") {
|
||||
$parent = dirname($path);
|
||||
$dir = $this->dir($parent);
|
||||
$file = array_values(array_filter($dir, function(IFileInfo $info) use ($path) {
|
||||
$file = array_values(array_filter($dir, function (IFileInfo $info) use ($path) {
|
||||
return $info->getPath() === $path;
|
||||
}));
|
||||
if ($file) {
|
||||
|
|
|
|||
|
|
@ -44,47 +44,47 @@ abstract class AbstractShareTest extends TestCase {
|
|||
}
|
||||
|
||||
public function nameProvider() {
|
||||
return array(
|
||||
array('simple'),
|
||||
array('with spaces_and-underscores'),
|
||||
array("single'quote'"),
|
||||
array("foo ; asd -- bar"),
|
||||
array('日本語'),
|
||||
array('url %2F +encode'),
|
||||
array('a somewhat longer filename than the other with more charaters as the all the other filenames'),
|
||||
array('$as#d€££Ö€ßœĚęĘĞĜΣΥΦΩΫ')
|
||||
);
|
||||
return [
|
||||
['simple'],
|
||||
['with spaces_and-underscores'],
|
||||
["single'quote'"],
|
||||
["foo ; asd -- bar"],
|
||||
['日本語'],
|
||||
['url %2F +encode'],
|
||||
['a somewhat longer filename than the other with more charaters as the all the other filenames'],
|
||||
['$as#d€££Ö€ßœĚęĘĞĜΣΥΦΩΫ']
|
||||
];
|
||||
}
|
||||
|
||||
public function invalidPathProvider() {
|
||||
// / ? < > \ : * | " are illegal characters in path on windows
|
||||
return array(
|
||||
array("new\nline"),
|
||||
array("\rreturn"),
|
||||
array('null' . chr(0) . 'byte'),
|
||||
array('foo?bar'),
|
||||
array('foo<bar>'),
|
||||
array('foo:bar'),
|
||||
array('foo*bar'),
|
||||
array('foo|bar'),
|
||||
array('foo"bar"')
|
||||
);
|
||||
return [
|
||||
["new\nline"],
|
||||
["\rreturn"],
|
||||
['null' . chr(0) . 'byte'],
|
||||
['foo?bar'],
|
||||
['foo<bar>'],
|
||||
['foo:bar'],
|
||||
['foo*bar'],
|
||||
['foo|bar'],
|
||||
['foo"bar"']
|
||||
];
|
||||
}
|
||||
|
||||
public function fileDataProvider() {
|
||||
return array(
|
||||
array('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua'),
|
||||
array('Mixed language, 日本語 が わからか and Various _/* characters \\|” €')
|
||||
);
|
||||
return [
|
||||
['Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua'],
|
||||
['Mixed language, 日本語 が わからか and Various _/* characters \\|” €']
|
||||
];
|
||||
}
|
||||
|
||||
public function nameAndDataProvider() {
|
||||
$names = $this->nameProvider();
|
||||
$data = $this->fileDataProvider();
|
||||
$result = array();
|
||||
$result = [];
|
||||
foreach ($names as $name) {
|
||||
foreach ($data as $text) {
|
||||
$result[] = array($name[0], $text[0]);
|
||||
$result[] = [$name[0], $text[0]];
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
|
|
@ -122,7 +122,7 @@ abstract class AbstractShareTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testRootStartsEmpty() {
|
||||
$this->assertEquals(array(), $this->share->dir($this->root));
|
||||
$this->assertEquals([], $this->share->dir($this->root));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -610,16 +610,16 @@ abstract class AbstractShareTest extends TestCase {
|
|||
|
||||
public function pathProvider() {
|
||||
// / ? < > \ : * | " are illegal characters in path on windows
|
||||
return array(
|
||||
array('dir/sub/foo.txt'),
|
||||
array('bar.txt'),
|
||||
array("single'quote'/sub/foo.txt"),
|
||||
array('日本語/url %2F +encode/asd.txt'),
|
||||
array(
|
||||
return [
|
||||
['dir/sub/foo.txt'],
|
||||
['bar.txt'],
|
||||
["single'quote'/sub/foo.txt"],
|
||||
['日本語/url %2F +encode/asd.txt'],
|
||||
[
|
||||
'a somewhat longer folder than the other with more charaters as the all the other filenames/' .
|
||||
'followed by a somewhat long file name after that.txt'
|
||||
)
|
||||
);
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ class NotifyHandlerTest extends TestCase {
|
|||
try {
|
||||
$share->mkdir('sub');
|
||||
} catch (AlreadyExistsException $e) {
|
||||
|
||||
}
|
||||
$process = $share->notify('sub');
|
||||
usleep(1000 * 100);// give it some time to start listening
|
||||
|
|
|
|||
|
|
@ -7,22 +7,21 @@
|
|||
|
||||
namespace Icewind\SMB\Test;
|
||||
|
||||
|
||||
use Icewind\SMB\IFileInfo;
|
||||
use Icewind\SMB\Wrapped\FileInfo;
|
||||
|
||||
class ParserTest extends \PHPUnit_Framework_TestCase {
|
||||
public function modeProvider() {
|
||||
return array(
|
||||
array('D', IFileInfo::MODE_DIRECTORY),
|
||||
array('A', IFileInfo::MODE_ARCHIVE),
|
||||
array('S', IFileInfo::MODE_SYSTEM),
|
||||
array('H', IFileInfo::MODE_HIDDEN),
|
||||
array('R', IFileInfo::MODE_READONLY),
|
||||
array('N', IFileInfo::MODE_NORMAL),
|
||||
array('RA', IFileInfo::MODE_READONLY | IFileInfo::MODE_ARCHIVE),
|
||||
array('RAH', IFileInfo::MODE_READONLY | IFileInfo::MODE_ARCHIVE | IFileInfo::MODE_HIDDEN)
|
||||
);
|
||||
return [
|
||||
['D', IFileInfo::MODE_DIRECTORY],
|
||||
['A', IFileInfo::MODE_ARCHIVE],
|
||||
['S', IFileInfo::MODE_SYSTEM],
|
||||
['H', IFileInfo::MODE_HIDDEN],
|
||||
['R', IFileInfo::MODE_READONLY],
|
||||
['N', IFileInfo::MODE_NORMAL],
|
||||
['RA', IFileInfo::MODE_READONLY | IFileInfo::MODE_ARCHIVE],
|
||||
['RAH', IFileInfo::MODE_READONLY | IFileInfo::MODE_ARCHIVE | IFileInfo::MODE_HIDDEN]
|
||||
];
|
||||
}
|
||||
/**
|
||||
* @dataProvider modeProvider
|
||||
|
|
@ -33,9 +32,9 @@ class ParserTest extends \PHPUnit_Framework_TestCase {
|
|||
}
|
||||
|
||||
public function statProvider() {
|
||||
return array(
|
||||
array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
[
|
||||
'altname: test.txt',
|
||||
'create_time: Sat Oct 12 07:05:58 PM 2013 CEST',
|
||||
'access_time: Tue Oct 15 02:58:48 PM 2013 CEST',
|
||||
|
|
@ -43,15 +42,15 @@ class ParserTest extends \PHPUnit_Framework_TestCase {
|
|||
'change_time: Sat Oct 12 07:05:58 PM 2013 CEST',
|
||||
'attributes: (80)',
|
||||
'stream: [::$DATA], 29634 bytes'
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'mtime' => strtotime('12 Oct 2013 19:05:58 CEST'),
|
||||
'mode' => IFileInfo::MODE_NORMAL,
|
||||
'size' => 29634
|
||||
)
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'mode' => IFileInfo::MODE_NORMAL,
|
||||
'size' => 29634
|
||||
]
|
||||
],
|
||||
[
|
||||
[
|
||||
'altname: folder',
|
||||
'create_time: Sat Oct 12 07:05:58 PM 2013 CEST',
|
||||
'access_time: Tue Oct 15 02:58:48 PM 2013 CEST',
|
||||
|
|
@ -59,15 +58,15 @@ class ParserTest extends \PHPUnit_Framework_TestCase {
|
|||
'change_time: Sat Oct 12 07:05:58 PM 2013 CEST',
|
||||
'attributes: D (10)',
|
||||
'stream: [::$DATA], 29634 bytes'
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'mtime' => strtotime('12 Oct 2013 19:05:58 CEST'),
|
||||
'mode' => IFileInfo::MODE_DIRECTORY,
|
||||
'size' => 29634
|
||||
)
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'mode' => IFileInfo::MODE_DIRECTORY,
|
||||
'size' => 29634
|
||||
]
|
||||
],
|
||||
[
|
||||
[
|
||||
'altname: .hidden',
|
||||
'create_time: Sat Oct 12 07:05:58 PM 2013 CEST',
|
||||
'access_time: Tue Oct 15 02:58:48 PM 2013 CEST',
|
||||
|
|
@ -75,14 +74,14 @@ class ParserTest extends \PHPUnit_Framework_TestCase {
|
|||
'change_time: Sat Oct 12 07:05:58 PM 2013 CEST',
|
||||
'attributes: HA (22)',
|
||||
'stream: [::$DATA], 29634 bytes'
|
||||
),
|
||||
array(
|
||||
],
|
||||
[
|
||||
'mtime' => strtotime('12 Oct 2013 19:05:58 CEST'),
|
||||
'mode' => IFileInfo::MODE_HIDDEN + IFileInfo::MODE_ARCHIVE,
|
||||
'size' => 29634
|
||||
)
|
||||
)
|
||||
);
|
||||
'mode' => IFileInfo::MODE_HIDDEN + IFileInfo::MODE_ARCHIVE,
|
||||
'size' => 29634
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -94,21 +93,26 @@ class ParserTest extends \PHPUnit_Framework_TestCase {
|
|||
}
|
||||
|
||||
public function dirProvider() {
|
||||
return array(
|
||||
array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
[
|
||||
' . D 0 Tue Aug 26 19:11:56 2014',
|
||||
' .. DR 0 Sun Oct 28 15:24:02 2012',
|
||||
' c.pdf N 29634 Sat Oct 12 19:05:58 2013',
|
||||
'',
|
||||
' 62536 blocks of size 8388608. 57113 blocks available'
|
||||
),
|
||||
array(
|
||||
new FileInfo('/c.pdf', 'c.pdf', 29634, strtotime('12 Oct 2013 19:05:58 CEST'),
|
||||
IFileInfo::MODE_NORMAL)
|
||||
)
|
||||
)
|
||||
);
|
||||
],
|
||||
[
|
||||
new FileInfo(
|
||||
'/c.pdf',
|
||||
'c.pdf',
|
||||
29634,
|
||||
strtotime('12 Oct 2013 19:05:58 CEST'),
|
||||
IFileInfo::MODE_NORMAL
|
||||
)
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace Icewind\SMB\Test;
|
||||
|
||||
|
||||
use Icewind\SMB\AnonymousAuth;
|
||||
use Icewind\SMB\IAuth;
|
||||
use Icewind\SMB\Native\NativeServer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue