You are here

public function FileSyncTest::testImportFiles in Tome 8

@covers \Drupal\tome_sync\FileSync::importFiles

File

modules/tome_sync/tests/src/Kernel/FileSyncTest.php, line 43

Class

FileSyncTest
Tests that the file sync works.

Namespace

Drupal\Tests\tome_sync\Kernel

Code

public function testImportFiles() {
  $directory = Settings::get('tome_files_directory') . '/public/foo';
  $this->fileSystem
    ->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY);
  touch(Settings::get('tome_files_directory') . '/public/foo/example.txt');
  touch(Settings::get('tome_files_directory') . '/public/example.txt');
  \Drupal::service('tome_sync.file_sync')
    ->importFiles();
  $this
    ->assertTrue(file_exists('public://foo/example.txt'));
  $this
    ->assertTrue(file_exists('public://example.txt'));
}