Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #24 from biigle/laravel-9
Browse files Browse the repository at this point in the history
Upgrade to Laravel 9
  • Loading branch information
mzur authored Feb 21, 2022
2 parents 1b16202 + fee66e2 commit b77ca72
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/Support/Import/ArchiveManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ public function delete($token)
*/
public function prune()
{
$files = $this->disk->listContents();
$files = $this->disk->listContents('/');
$limit = Carbon::now()->subWeek()->getTimestamp();
foreach ($files as $metadata) {
if ($metadata['timestamp'] < $limit) {
$this->disk->delete($metadata['path']);
foreach ($files as $file) {
if ($file->lastModified() < $limit) {
$this->disk->delete($file->path());
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Support/Export/PublicLabelTreeExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public function testGetContent()
'description' => $tree->description,
'uuid' => $tree->uuid,
'version' => null,
'created_at' => (string) $tree->created_at,
'updated_at' => (string) $tree->updated_at,
'created_at' => $tree->created_at->toJson(),
'updated_at' => $tree->updated_at->toJson(),
];

$this->assertEquals($expect, $export->getContent());
Expand All @@ -51,8 +51,8 @@ public function testGetContentVersion()
'name' => $version->name,
'doi' => $version->doi,
],
'created_at' => (string) $tree->created_at,
'updated_at' => (string) $tree->updated_at,
'created_at' => $tree->created_at->toJson(),
'updated_at' => $tree->updated_at->toJson(),
];

$this->assertEquals($expect, $export->getContent());
Expand Down
8 changes: 4 additions & 4 deletions tests/Support/Import/ArchiveManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testStoreUserExportNotAllowed()
$this->assertFalse(true);
} catch (Exception $e) {
$this->assertStringContainsString('User imports are not allowed', $e->getMessage());
$this->assertEmpty(Storage::disk('test')->listContents());
$this->assertEmpty(Storage::disk('test')->listContents('/')->toArray());
}
}

Expand Down Expand Up @@ -83,7 +83,7 @@ public function testStoreLabelTreeExportNotAllowed()
$this->assertFalse(true);
} catch (Exception $e) {
$this->assertStringContainsString('Label tree imports are not allowed', $e->getMessage());
$this->assertEmpty(Storage::disk('test')->listContents());
$this->assertEmpty(Storage::disk('test')->listContents('/')->toArray());
}
}

Expand Down Expand Up @@ -113,7 +113,7 @@ public function testStoreVolumeExportNotAllowed()
$this->assertFalse(true);
} catch (Exception $e) {
$this->assertStringContainsString('Volume imports are not allowed', $e->getMessage());
$this->assertEmpty(Storage::disk('test')->listContents());
$this->assertEmpty(Storage::disk('test')->listContents('/')->toArray());
}
}

Expand Down Expand Up @@ -175,7 +175,7 @@ public function testPrune()

$manager = new ArchiveManager;
$token = $manager->store($file);
$path = Storage::disk('test')->getAdapter()->applyPathPrefix($token);
$path = storage_path("framework/testing/disks/test/{$token}");

$manager->prune();
$this->assertTrue($manager->has($token));
Expand Down

0 comments on commit b77ca72

Please sign in to comment.