You are here

public function S3Test::testEnsure in Flysystem - S3 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Unit/Flysystem/S3Test.php \NoDrupal\Tests\flysystem_s3\Unit\Flysystem\S3Test::testEnsure()

File

tests/src/Unit/Flysystem/S3Test.php, line 138

Class

S3Test
@coversDefaultClass \Drupal\flysystem_s3\Flysystem\S3 @covers \Drupal\flysystem_s3\Flysystem\S3 @group flysystem_s3

Namespace

NoDrupal\Tests\flysystem_s3\Unit\Flysystem

Code

public function testEnsure() {
  $client = $this
    ->prophesize(S3ClientInterface::class);
  $client
    ->doesBucketExist(Argument::type('string'))
    ->willReturn(TRUE);
  $plugin = new S3($client
    ->reveal(), new Config([
    'bucket' => 'example-bucket',
  ]));
  $this
    ->assertSame([], $plugin
    ->ensure());
  $client
    ->doesBucketExist(Argument::type('string'))
    ->willReturn(FALSE);
  $plugin = new S3($client
    ->reveal(), new Config([
    'bucket' => 'example-bucket',
  ]));
  $result = $plugin
    ->ensure();
  $this
    ->assertSame(1, count($result));
  $this
    ->assertSame(RfcLogLevel::ERROR, $result[0]['severity']);
}