Skip to content

Commit 7514188

Browse files
daniserSergey Danilchenko
andauthored
[12.x] Clean up after filesystem manager tests (#57168)
Co-authored-by: Sergey Danilchenko <[email protected]>
1 parent b6e8f1e commit 7514188

File tree

1 file changed

+39
-31
lines changed

1 file changed

+39
-31
lines changed

tests/Filesystem/FilesystemManagerTest.php

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -167,25 +167,29 @@ public function testCanBuildScopedDisksWithVisibility()
167167

168168
public function testCanBuildScopedDisksWithThrow()
169169
{
170-
$filesystem = new FilesystemManager(tap(new Application, function ($app) {
171-
$app['config'] = [
172-
'filesystems.disks.local' => [
173-
'driver' => 'local',
174-
'root' => 'to-be-scoped',
175-
'throw' => false,
176-
],
177-
];
178-
}));
170+
try {
171+
$filesystem = new FilesystemManager(tap(new Application, function ($app) {
172+
$app['config'] = [
173+
'filesystems.disks.local' => [
174+
'driver' => 'local',
175+
'root' => 'to-be-scoped',
176+
'throw' => false,
177+
],
178+
];
179+
}));
179180

180-
$scoped = $filesystem->build([
181-
'driver' => 'scoped',
182-
'disk' => 'local',
183-
'prefix' => 'path-prefix',
184-
'throw' => true,
185-
]);
181+
$scoped = $filesystem->build([
182+
'driver' => 'scoped',
183+
'disk' => 'local',
184+
'prefix' => 'path-prefix',
185+
'throw' => true,
186+
]);
186187

187-
$this->expectException(UnableToReadFile::class);
188-
$scoped->get('dirname/filename.txt');
188+
$this->expectException(UnableToReadFile::class);
189+
$scoped->get('dirname/filename.txt');
190+
} finally {
191+
rmdir(__DIR__.'/../../to-be-scoped');
192+
}
189193
}
190194

191195
public function testCanBuildInlineScopedDisks()
@@ -215,21 +219,25 @@ public function testCanBuildInlineScopedDisks()
215219

216220
public function testKeepTrackOfAdapterDecoration()
217221
{
218-
$filesystem = new FilesystemManager(tap(new Application, function ($app) {
219-
$app['config'] = [
220-
'filesystems.disks.local' => [
221-
'driver' => 'local',
222-
'root' => 'to-be-scoped',
223-
],
224-
];
225-
}));
222+
try {
223+
$filesystem = new FilesystemManager(tap(new Application, function ($app) {
224+
$app['config'] = [
225+
'filesystems.disks.local' => [
226+
'driver' => 'local',
227+
'root' => 'to-be-scoped',
228+
],
229+
];
230+
}));
226231

227-
$scoped = $filesystem->build([
228-
'driver' => 'scoped',
229-
'disk' => 'local',
230-
'prefix' => 'path-prefix',
231-
]);
232+
$scoped = $filesystem->build([
233+
'driver' => 'scoped',
234+
'disk' => 'local',
235+
'prefix' => 'path-prefix',
236+
]);
232237

233-
$this->assertInstanceOf(PathPrefixedAdapter::class, $scoped->getAdapter());
238+
$this->assertInstanceOf(PathPrefixedAdapter::class, $scoped->getAdapter());
239+
} finally {
240+
rmdir(__DIR__.'/../../to-be-scoped');
241+
}
234242
}
235243
}

0 commit comments

Comments
 (0)