/** * @covers \Drupal\amazons3\S3Client::factory */ 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); }
/** * Test that we can set a different S3 client class. * * @covers \Drupal\amazons3\StreamWrapper::setS3ClientClass */ public function testSetS3ClientClass() { StreamWrapper::setS3ClientClass('Drupal\\amazons3Test\\Stub\\S3Client'); StreamWrapper::setClient(NULL); DrupalS3Client::resetCalled(); new StreamWrapper(); $this->assertTrue(DrupalS3Client::isCalled()); }