function ClientFactoryTest::testCreateFromOptions

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php \Drupal\Tests\Core\Http\ClientFactoryTest::testCreateFromOptions()
  2. 8.9.x core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php \Drupal\Tests\Core\Http\ClientFactoryTest::testCreateFromOptions()
  3. 11.x core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php \Drupal\Tests\Core\Http\ClientFactoryTest::testCreateFromOptions()

@covers ::fromOptions @dataProvider providerTestCreateFromOptions

Parameters

array $settings_config: The settings configuration.

array $parameter_config: The parameter configuration.

array $expected_config_keys: The expected config keys.

File

core/tests/Drupal/Tests/Core/Http/ClientFactoryTest.php, line 47

Class

ClientFactoryTest
@coversDefaultClass \Drupal\Core\Http\ClientFactory @group Http

Namespace

Drupal\Tests\Core\Http

Code

public function testCreateFromOptions($settings_config, $parameter_config, $expected_config_keys) : void {
    if ($settings_config) {
        new Settings([
            'http_client_config' => $settings_config,
        ]);
    }
    else {
        new Settings([]);
    }
    $client = $this->factory
        ->fromOptions($parameter_config);
    foreach ($expected_config_keys as $key => $expected) {
        $this->assertSame($expected, $client->getConfig($key));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.