X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ffile%2Ftests%2Fsrc%2FFunctional%2FMultipleFileUploadTest.php;fp=web%2Fcore%2Fmodules%2Ffile%2Ftests%2Fsrc%2FFunctional%2FMultipleFileUploadTest.php;h=587d4479efebf555a8fb8c20e9927bf0be31cb1e;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=0000000000000000000000000000000000000000;hpb=9424afc6c1f518c301bf87a23c047d1873435d05;p=yaffs-website diff --git a/web/core/modules/file/tests/src/Functional/MultipleFileUploadTest.php b/web/core/modules/file/tests/src/Functional/MultipleFileUploadTest.php new file mode 100644 index 000000000..587d4479e --- /dev/null +++ b/web/core/modules/file/tests/src/Functional/MultipleFileUploadTest.php @@ -0,0 +1,59 @@ +drupalCreateUser(['administer themes']); + $this->drupalLogin($admin); + } + + /** + * Tests multiple file field with all file extensions. + */ + public function testMultipleFileFieldWithAllFileExtensions() { + $theme = 'test_theme_settings'; + \Drupal::service('theme_handler')->install([$theme]); + $this->drupalGet("admin/appearance/settings/$theme"); + + $edit = []; + // Create few files with non-typical extensions. + foreach (['file1.wtf', 'file2.wtf'] as $i => $file) { + $file_path = $this->root . "/sites/default/files/simpletest/$file"; + file_put_contents($file_path, 'File with non-default extension.', FILE_APPEND | LOCK_EX); + $edit["files[multi_file][$i]"] = $file_path; + } + + // @todo: Replace after https://www.drupal.org/project/drupal/issues/2917885 + $this->drupalGet("admin/appearance/settings/$theme"); + $submit_xpath = $this->assertSession()->buttonExists('Save configuration')->getXpath(); + $client = $this->getSession()->getDriver()->getClient(); + $form = $client->getCrawler()->filterXPath($submit_xpath)->form(); + $client->request($form->getMethod(), $form->getUri(), $form->getPhpValues(), $edit); + + $page = $this->getSession()->getPage(); + $this->assertNotContains('Only files with the following extensions are allowed', $page->getContent()); + $this->assertContains('The configuration options have been saved.', $page->getContent()); + $this->assertContains('file1.wtf', $page->getContent()); + $this->assertContains('file2.wtf', $page->getContent()); + } + +}