'public', 'path' => '0', ]); try { $file->assertStoredFileExists(); $this->fail('Expected NotFoundHttpException'); } catch (NotFoundHttpException $e) { $this->assertSame('附件文件不存在或已丢失', $e->getMessage()); } } public function test_assert_stored_file_exists_passes_when_file_present(): void { Storage::fake('public'); Storage::disk('public')->put('applications/1/plan.pdf', 'ok'); $file = new ApplicationFile([ 'disk' => 'public', 'path' => 'applications/1/plan.pdf', ]); $file->assertStoredFileExists(); $this->addToAssertionCount(1); } }