You are here

public function ConfigFormTest::testCopyFile 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::testCopyFile()
  2. 2.0.x tests/src/Unit/Form/ConfigFormTest.php \Drupal\Tests\flysystem\Unit\Form\ConfigFormTest::testCopyFile()
  3. 3.0.x tests/src/Unit/Form/ConfigFormTest.php \Drupal\Tests\flysystem\Unit\Form\ConfigFormTest::testCopyFile()

@covers ::copyFile

File

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

Class

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

Namespace

Drupal\Tests\flysystem\Unit\Form

Code

public function testCopyFile() {
  $context = [];
  $from = new Filesystem(new MemoryAdapter());
  $from
    ->write('dir/test.txt', 'abcdefg');
  $this->factory
    ->getFilesystem('from_files')
    ->willReturn($from);
  ConfigForm::copyFile('from_files', 'to_empty', 'dir/test.txt', $context);
  $this
    ->assertSame('abcdefg', $this->factory
    ->reveal()
    ->getFilesystem('to_empty')
    ->read('dir/test.txt'));
  $this
    ->assertTrue(empty($context['results']));
  $this
    ->assertSame(1, $context['finished']);
}