diff --git a/src/Support/Import/ArchiveManager.php b/src/Support/Import/ArchiveManager.php index 720db63..4fa92d0 100644 --- a/src/Support/Import/ArchiveManager.php +++ b/src/Support/Import/ArchiveManager.php @@ -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()); } } } diff --git a/tests/Support/Export/PublicLabelTreeExportTest.php b/tests/Support/Export/PublicLabelTreeExportTest.php index b96994b..7b769c7 100644 --- a/tests/Support/Export/PublicLabelTreeExportTest.php +++ b/tests/Support/Export/PublicLabelTreeExportTest.php @@ -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()); @@ -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()); diff --git a/tests/Support/Import/ArchiveManagerTest.php b/tests/Support/Import/ArchiveManagerTest.php index 587869a..be914b4 100644 --- a/tests/Support/Import/ArchiveManagerTest.php +++ b/tests/Support/Import/ArchiveManagerTest.php @@ -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()); } } @@ -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()); } } @@ -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()); } } @@ -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));