You are here

public function ConfigFormTest::testCopyFileFailedRead in Flysystem 8

Same name and namespace in other branches
  1. 3.x tests/src/Unit/Form/ConfigFormTest.php \Drupal\Tests\flysystem\Unit\Form\ConfigFormTest::testCopyFileFailedRead()
  2. 2.0.x tests/src/Unit/Form/ConfigFormTest.php \Drupal\Tests\flysystem\Unit\Form\ConfigFormTest::testCopyFileFailedRead()
  3. 3.0.x tests/src/Unit/Form/ConfigFormTest.php \Drupal\Tests\flysystem\Unit\Form\ConfigFormTest::testCopyFileFailedRead()

@covers ::copyFile

File

tests/src/Unit/Form/ConfigFormTest.php, line 177

Class

ConfigFormTest
@coversDefaultClass \Drupal\flysystem\Form\ConfigForm @group flysystem

Namespace

Drupal\Tests\flysystem\Unit\Form

Code

public function testCopyFileFailedRead() {

  // Tests failed read.
  $context = [];
  $failed_read = $this
    ->prophesize(FilesystemInterface::class);
  $failed_read
    ->readStream('does_not_exist')
    ->willReturn(FALSE);
  $this->factory
    ->getFilesystem('failed_read')
    ->willReturn($failed_read
    ->reveal());
  ConfigForm::copyFile('failed_read', 'to_empty', 'does_not_exist', $context);
  $to_files = $this->factory
    ->reveal()
    ->getFilesystem('to_empty')
    ->listContents('', TRUE);
  $this
    ->assertSame(0, count($to_files));
  $this
    ->assertSame(1, count($context['results']['errors']));
}