withPermission('cms.manage_assets', true); $this->actingAs($user); $controller = new Index; $assetList = $controller->widget->assetList; $this->assertNotNull($assetList, 'assetList widget should be registered'); // Simulate a request with a mismatched theme name Request::merge(['theme' => 'nonexistent-theme']); $this->expectException(ApplicationException::class); $assetList->onUpload(); } }