You are here

public function FieldValidationTest::testValidateArchiveFormat in Mini site 8

Tests the archive format on minisite field.

File

tests/src/Functional/FieldValidationTest.php, line 69

Class

FieldValidationTest
Tests the minisite field validation.

Namespace

Drupal\Tests\minisite\Functional

Code

public function testValidateArchiveFormat() {
  $field_name = strtolower($this
    ->randomMachineName());
  $this
    ->createMinisiteField($field_name, 'node', $this->contentType, [], [
    'required' => '1',
  ]);

  // Try uploading a file with correct extension, but invalid format.
  $test_file = $this
    ->getTestArchiveInvalidFormat();
  $this
    ->uploadNodeFile($test_file, $field_name, $this->contentType);
  $this
    ->assertRaw($this
    ->t('The specified file %filename could not be uploaded.', [
    '%filename' => $test_file
      ->getFilename(),
  ]));
  $this
    ->assertRaw($this
    ->t('File @filename is not an archive file.', [
    '@filename' => $test_file
      ->getFilename(),
  ]));
}