You are here

public function S3ClientTest::testCurlOptions in AmazonS3 7.2

@covers \Drupal\amazons3\S3Client::factory

File

tests/S3ClientTest.php, line 67

Class

S3ClientTest
Tests \Drupal\amazons3\S3Client.

Namespace

Drupal\amazons3

Code

public function testCurlOptions() {
  $client = DrupalS3Client::factory();
  $curl = $client
    ->getConfig('curl.options');
  $this
    ->assertArraySubset([
    CURLOPT_CONNECTTIMEOUT => 30,
  ], $curl);
  $config = [
    'curl.options' => [
      CURLOPT_CONNECTTIMEOUT => 10,
    ],
  ];
  $client = DrupalS3Client::factory($config);
  $curl = $client
    ->getConfig('curl.options');
  $this
    ->assertArraySubset([
    CURLOPT_CONNECTTIMEOUT => 10,
  ], $curl);
  $config = [
    'curl.options' => [
      CURLOPT_VERBOSE => TRUE,
    ],
  ];
  $client = DrupalS3Client::factory($config);
  $curl = $client
    ->getConfig('curl.options');
  $this
    ->assertArraySubset([
    CURLOPT_CONNECTTIMEOUT => 30,
  ], $curl);
  $this
    ->assertArraySubset([
    CURLOPT_VERBOSE => TRUE,
  ], $curl);
}