You are here

public function ConfigFormTest::testCopyFile in Flysystem 3.0.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/Form/ConfigFormTest.php \Drupal\Tests\flysystem\Unit\Form\ConfigFormTest::testCopyFile()
  2. 3.x tests/src/Unit/Form/ConfigFormTest.php \Drupal\Tests\flysystem\Unit\Form\ConfigFormTest::testCopyFile()
  3. 2.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 164

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']);
}