Mocking Settings (settings.php) within Unit tests Drupal's Settings class is marked final and has no interface, meaning traditional PHPUnit mocking techniques will not work out of the box. Is it necessary to install third-party tools to be able to mock this or is there another way?
At first glance Settings appears to be read-only, however the constructor is quite forgiving in its parameters. We can construct a fake settings structure like so:
$site_settings = [
  'http_services_api' =&gt; [
    'auth_services' =&gt; [
      'title' =&gt; 'Auth Services',
      'config' =&gt; [
        'base_uri' =&gt; 'https://demo.api-platform.com/auth'
      ],
    ],
    'resource_services' =&gt; [
      'title' =&gt; 'Resource Services',
      'config' =&gt; [
        'base_uri' =&gt; 'https://demo.api-platform.com/books'
      ],
    ],
  ],
];

new Settings($site_settings);

This is alluded too here but never fully described.
Edit: I have added an example to the docs linked.