Skip to content

Commit 20cca35

Browse files
committed
Updated readme and test
1 parent d4c41d2 commit 20cca35

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use Icewind\SMB\ServerFactory;
77
use League\Flysystem\Filesystem;
88
use RobGridley\Flysystem\Smb\SmbAdapter;
99

10-
$factory = new ServerFactory;
10+
$factory = new ServerFactory();
1111
$auth = new BasicAuth('username', 'domain/workgroup', 'password');
1212
$server = $factory->createServer('host', $auth);
1313
$share = $server->getShare('name');
@@ -19,3 +19,6 @@ $filesystem = new Filesystem(new SmbAdapter($share));
1919
```
2020
$ composer require robgridley/flysystem-smb
2121
```
22+
23+
## Note
24+
This adapter does not support visibility. Calls to `visibility()` or `setVisibility()` throw exceptions and setting visibility via writes, moves, etc. is ignored.

tests/SmbAdapterTest.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ protected static function createFilesystemAdapter(): FilesystemAdapter
2828
*/
2929
public function setting_visibility(): void
3030
{
31-
$adapter = $this->adapter();
32-
$this->givenWeHaveAnExistingFile('some/file.txt');
31+
$this->runScenario(function () {
32+
$adapter = $this->adapter();
33+
$this->givenWeHaveAnExistingFile('path.txt', 'contents', [Config::OPTION_VISIBILITY => Visibility::PUBLIC]);
3334

34-
$this->expectException(UnableToSetVisibility::class);
35+
$this->expectException(UnableToSetVisibility::class);
3536

36-
$adapter->setVisibility('some/file.txt', Visibility::PRIVATE);
37+
$adapter->setVisibility('path.txt', Visibility::PRIVATE);
38+
});
3739
}
3840

3941
/**
@@ -42,10 +44,10 @@ public function setting_visibility(): void
4244
public function overwriting_a_file(): void
4345
{
4446
$this->runScenario(function () {
45-
$this->givenWeHaveAnExistingFile('path.txt', 'contents');
47+
$this->givenWeHaveAnExistingFile('path.txt', 'contents', ['visibility' => Visibility::PUBLIC]);
4648
$adapter = $this->adapter();
4749

48-
$adapter->write('path.txt', 'new contents', new Config());
50+
$adapter->write('path.txt', 'new contents', new Config(['visibility' => Visibility::PRIVATE]));
4951

5052
$contents = $adapter->read('path.txt');
5153
$this->assertEquals('new contents', $contents);
@@ -62,7 +64,7 @@ public function copying_a_file(): void
6264
$adapter->write(
6365
'source.txt',
6466
'contents to be copied',
65-
new Config()
67+
new Config([Config::OPTION_VISIBILITY => Visibility::PUBLIC])
6668
);
6769

6870
$adapter->copy('source.txt', 'destination.txt', new Config());
@@ -83,7 +85,7 @@ public function copying_a_file_again(): void
8385
$adapter->write(
8486
'source.txt',
8587
'contents to be copied',
86-
new Config()
88+
new Config([Config::OPTION_VISIBILITY => Visibility::PUBLIC])
8789
);
8890

8991
$adapter->copy('source.txt', 'destination.txt', new Config());
@@ -104,7 +106,7 @@ public function moving_a_file(): void
104106
$adapter->write(
105107
'source.txt',
106108
'contents to be copied',
107-
new Config()
109+
new Config([Config::OPTION_VISIBILITY => Visibility::PUBLIC])
108110
);
109111
$adapter->move('source.txt', 'destination.txt', new Config());
110112
$this->assertFalse(

0 commit comments

Comments
 (0)