From 116ebd1e2c1c5df98965e0300fef04e07a0566f9 Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Mon, 14 Jun 2021 09:26:39 +0100 Subject: [PATCH] Issue #3217706 by Spokje, longwave, guilhermevp, mondrake: Replace usages of assertFileNotExists(), that is deprecated --- .../src/Functional/FileFieldRevisionTest.php | 4 +-- .../tests/src/Functional/SaveUploadTest.php | 4 +-- .../file/tests/src/Kernel/DeleteTest.php | 6 ++-- .../file/tests/src/Kernel/MoveTest.php | 6 ++-- .../file/tests/src/Kernel/UsageTest.php | 2 +- .../tests/src/Functional/FileMoveTest.php | 2 +- .../src/Functional/ImageDimensionsTest.php | 20 ++++++------- .../Functional/ImageEffect/ConvertTest.php | 2 +- .../src/Functional/ImageFieldValidateTest.php | 4 +-- .../Functional/ImageStylesPathAndUrlTest.php | 6 ++-- .../tests/src/Functional/FileUploadTest.php | 16 +++++------ .../LocaleTranslationDownloadTest.php | 2 +- .../Functional/LocaleTranslationUiTest.php | 2 +- .../FunctionalJavascript/WidgetUploadTest.php | 4 +-- .../tests/src/Kernel/process/DownloadTest.php | 2 +- .../tests/src/Kernel/process/FileCopyTest.php | 2 +- .../src/Functional/MigrateUpgradeTestBase.php | 2 +- .../Functional/FileUploadResourceTestBase.php | 16 +++++------ .../tests/src/Functional/UpdateUploadTest.php | 2 +- .../Kernel/UpdateDeleteFileIfStaleTest.php | 2 +- .../tests/src/Functional/UserPictureTest.php | 2 +- .../Template/ComposerProjectTemplatesTest.php | 2 +- .../Ajax/FormValuesTest.php | 2 +- .../Bootstrap/UncaughtExceptionTest.php | 2 +- .../KernelTests/Core/File/DirectoryTest.php | 4 +-- .../KernelTests/Core/File/FileCopyTest.php | 2 +- .../Core/File/FileDeleteRecursiveTest.php | 10 +++---- .../KernelTests/Core/File/FileDeleteTest.php | 2 +- .../KernelTests/Core/File/FileMoveTest.php | 6 ++-- .../KernelTests/Core/File/PharWrapperTest.php | 2 +- .../Core/Test/EnvironmentCleanerTest.php | 4 +-- .../Core/Theme/ThemeSettingsTest.php | 2 +- .../Scaffold/Functional/ComposerHookTest.php | 8 +++--- .../Functional/ManageGitIgnoreTest.php | 28 +++++++++---------- .../Scaffold/Functional/ScaffoldTest.php | 4 +-- .../Scaffold/Integration/AppendOpTest.php | 2 +- .../Scaffold/Integration/ReplaceOpTest.php | 2 +- .../Scaffold/Integration/SkipOpTest.php | 4 +-- .../VendorHardeningPluginTest.php | 10 +++---- .../Tests/Core/Command/GenerateThemeTest.php | 2 +- .../Drupal/Tests/Core/File/FileSystemTest.php | 2 +- .../Listeners/DeprecationListenerTrait.php | 1 - .../Tests/Scripts/TestSiteApplicationTest.php | 6 ++-- 43 files changed, 107 insertions(+), 108 deletions(-) diff --git a/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php b/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php index 6aa909158945..8ebdd16293e2 100644 --- a/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php @@ -138,7 +138,7 @@ public function testRevisions() { ->execute(); \Drupal::service('cron')->run(); - $this->assertFileNotExists($node_file_r3->getFileUri()); + $this->assertFileDoesNotExist($node_file_r3->getFileUri()); $this->assertFileEntryNotExists($node_file_r3, 'Second file entry is now deleted after deleting third revision, since it is no longer being used by any other nodes.'); // Delete the entire node and check that the original file is deleted. @@ -155,7 +155,7 @@ public function testRevisions() { ->condition('fid', $node_file_r1->id()) ->execute(); \Drupal::service('cron')->run(); - $this->assertFileNotExists($node_file_r1->getFileUri()); + $this->assertFileDoesNotExist($node_file_r1->getFileUri()); $this->assertFileEntryNotExists($node_file_r1, 'Original file entry is deleted after deleting the entire node with two revisions remaining.'); } diff --git a/core/modules/file/tests/src/Functional/SaveUploadTest.php b/core/modules/file/tests/src/Functional/SaveUploadTest.php index bf8b822e3b04..4b9af9dccd14 100644 --- a/core/modules/file/tests/src/Functional/SaveUploadTest.php +++ b/core/modules/file/tests/src/Functional/SaveUploadTest.php @@ -714,7 +714,7 @@ public function testInvalidUtf8FilenameUpload() { 'http_errors' => FALSE, ]; - $this->assertFileNotExists('temporary://' . $filename); + $this->assertFileDoesNotExist('temporary://' . $filename); // Use Guzzle's HTTP client directly so we can POST files without having to // write them to disk. Not all filesystem support writing files with invalid // UTF-8 filenames. @@ -725,7 +725,7 @@ public function testInvalidUtf8FilenameUpload() { $error_text = new FormattableMarkup('The file %filename could not be uploaded because the name is invalid.', ['%filename' => $filename]); $this->assertStringContainsString((string) $error_text, $content); $this->assertStringContainsString('Epic upload FAIL!', $content); - $this->assertFileNotExists('temporary://' . $filename); + $this->assertFileDoesNotExist('temporary://' . $filename); } } diff --git a/core/modules/file/tests/src/Kernel/DeleteTest.php b/core/modules/file/tests/src/Kernel/DeleteTest.php index cf14efc205bf..59b0ea405388 100644 --- a/core/modules/file/tests/src/Kernel/DeleteTest.php +++ b/core/modules/file/tests/src/Kernel/DeleteTest.php @@ -22,7 +22,7 @@ public function testUnused() { $this->assertFileExists($file->getFileUri()); $file->delete(); $this->assertFileHooksCalled(['delete']); - $this->assertFileNotExists($file->getFileUri()); + $this->assertFileDoesNotExist($file->getFileUri()); $this->assertNull(File::load($file->id()), 'File was removed from the database.'); } @@ -73,7 +73,7 @@ public function testInUse() { // file_cron() loads $this->assertFileHooksCalled(['delete']); - $this->assertFileNotExists($file->getFileUri()); + $this->assertFileDoesNotExist($file->getFileUri()); $this->assertNull(File::load($file->id()), 'File was removed from the database.'); } @@ -84,7 +84,7 @@ public function testCronDeleteNonExistingTemporary() { $file = $this->createFile(); // Delete the file, but leave it in the file_managed table. \Drupal::service('file_system')->delete($file->getFileUri()); - $this->assertFileNotExists($file->getFileUri()); + $this->assertFileDoesNotExist($file->getFileUri()); $this->assertInstanceOf(File::class, File::load($file->id())); // Call file_cron() to clean up the file. Make sure the changed timestamp diff --git a/core/modules/file/tests/src/Kernel/MoveTest.php b/core/modules/file/tests/src/Kernel/MoveTest.php index bc2404138216..c4c999862c7d 100644 --- a/core/modules/file/tests/src/Kernel/MoveTest.php +++ b/core/modules/file/tests/src/Kernel/MoveTest.php @@ -27,7 +27,7 @@ public function testNormal() { // Check the return status and that the contents changed. $this->assertNotFalse($result, 'File moved successfully.'); - $this->assertFileNotExists($source->getFileUri()); + $this->assertFileDoesNotExist($source->getFileUri()); $this->assertEquals($contents, file_get_contents($result->getFileUri()), 'Contents of file correctly written.'); // Check that the correct hooks were called. @@ -59,7 +59,7 @@ public function testExistingRename() { // Check the return status and that the contents changed. $this->assertNotFalse($result, 'File moved successfully.'); - $this->assertFileNotExists($source->getFileUri()); + $this->assertFileDoesNotExist($source->getFileUri()); $this->assertEquals($contents, file_get_contents($result->getFileUri()), 'Contents of file correctly written.'); // Check that the correct hooks were called. @@ -94,7 +94,7 @@ public function testExistingReplace() { // Look at the results. $this->assertEquals($contents, file_get_contents($result->getFileUri()), 'Contents of file were overwritten.'); - $this->assertFileNotExists($source->getFileUri()); + $this->assertFileDoesNotExist($source->getFileUri()); $this->assertNotEmpty($result, 'File moved successfully.'); // Check that the correct hooks were called. diff --git a/core/modules/file/tests/src/Kernel/UsageTest.php b/core/modules/file/tests/src/Kernel/UsageTest.php index 80037c020abc..9cd47fe18f07 100644 --- a/core/modules/file/tests/src/Kernel/UsageTest.php +++ b/core/modules/file/tests/src/Kernel/UsageTest.php @@ -195,7 +195,7 @@ public function testTempFileCleanupDefault() { // Run cron and then ensure that only the old, temp file was deleted. $this->container->get('cron')->run(); - $this->assertFileNotExists($temp_old->getFileUri()); + $this->assertFileDoesNotExist($temp_old->getFileUri()); $this->assertFileExists($temp_new->getFileUri()); $this->assertFileExists($perm_old->getFileUri()); $this->assertFileExists($perm_new->getFileUri()); diff --git a/core/modules/image/tests/src/Functional/FileMoveTest.php b/core/modules/image/tests/src/Functional/FileMoveTest.php index 113c0c8f3242..daef5600081e 100644 --- a/core/modules/image/tests/src/Functional/FileMoveTest.php +++ b/core/modules/image/tests/src/Functional/FileMoveTest.php @@ -58,7 +58,7 @@ public function testNormal() { $this->assertFileExists($result->getFileUri()); // Check if derivative image has been flushed. - $this->assertFileNotExists($derivative_uri); + $this->assertFileDoesNotExist($derivative_uri); } } diff --git a/core/modules/image/tests/src/Functional/ImageDimensionsTest.php b/core/modules/image/tests/src/Functional/ImageDimensionsTest.php index 70303aeee598..9fa6affb151e 100644 --- a/core/modules/image/tests/src/Functional/ImageDimensionsTest.php +++ b/core/modules/image/tests/src/Functional/ImageDimensionsTest.php @@ -78,7 +78,7 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); $this->assertEquals('<img src="' . $url . '" width="120" height="60" alt="" loading="lazy" class="image-style-test" />', $this->getImageTag($variables)); - $this->assertFileNotExists($generated_uri); + $this->assertFileDoesNotExist($generated_uri); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertSession()->statusCodeEquals(200); $this->assertFileExists($generated_uri); @@ -99,7 +99,7 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); $this->assertEquals('<img src="' . $url . '" width="60" height="120" alt="" loading="lazy" class="image-style-test" />', $this->getImageTag($variables)); - $this->assertFileNotExists($generated_uri); + $this->assertFileDoesNotExist($generated_uri); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertSession()->statusCodeEquals(200); $this->assertFileExists($generated_uri); @@ -121,7 +121,7 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); $this->assertEquals('<img src="' . $url . '" width="45" height="90" alt="" loading="lazy" class="image-style-test" />', $this->getImageTag($variables)); - $this->assertFileNotExists($generated_uri); + $this->assertFileDoesNotExist($generated_uri); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertSession()->statusCodeEquals(200); $this->assertFileExists($generated_uri); @@ -143,7 +143,7 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); $this->assertEquals('<img src="' . $url . '" width="45" height="90" alt="" loading="lazy" class="image-style-test" />', $this->getImageTag($variables)); - $this->assertFileNotExists($generated_uri); + $this->assertFileDoesNotExist($generated_uri); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertSession()->statusCodeEquals(200); $this->assertFileExists($generated_uri); @@ -161,7 +161,7 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); $this->assertEquals('<img src="' . $url . '" width="45" height="90" alt="" loading="lazy" class="image-style-test" />', $this->getImageTag($variables)); - $this->assertFileNotExists($generated_uri); + $this->assertFileDoesNotExist($generated_uri); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertSession()->statusCodeEquals(200); $this->assertFileExists($generated_uri); @@ -182,7 +182,7 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); $this->assertEquals('<img src="' . $url . '" alt="" class="image-style-test" />', $this->getImageTag($variables)); - $this->assertFileNotExists($generated_uri); + $this->assertFileDoesNotExist($generated_uri); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertSession()->statusCodeEquals(200); $this->assertFileExists($generated_uri); @@ -201,7 +201,7 @@ public function testImageDimensions() { $style->addImageEffect($effect); $style->save(); $this->assertEquals('<img src="' . $url . '" width="30" height="30" alt="" loading="lazy" class="image-style-test" />', $this->getImageTag($variables)); - $this->assertFileNotExists($generated_uri); + $this->assertFileDoesNotExist($generated_uri); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertSession()->statusCodeEquals(200); $this->assertFileExists($generated_uri); @@ -224,7 +224,7 @@ public function testImageDimensions() { // @todo Uncomment this once // https://www.drupal.org/project/drupal/issues/2670966 is resolved. // $this->assertEquals('<img src="' . $url . '" width="41" height="41" alt="" class="image-style-test" />', $this->getImageTag($variables)); - $this->assertFileNotExists($generated_uri); + $this->assertFileDoesNotExist($generated_uri); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertSession()->statusCodeEquals(200); $this->assertFileExists($generated_uri); @@ -268,7 +268,7 @@ public function testImageDimensions() { $generated_uri = 'public://styles/test_uri/public/' . $file_system->basename($original_uri); $url = file_url_transform_relative($style->buildUrl($original_uri)); $this->assertEquals('<img src="' . $url . '" width="100" height="100" alt="" loading="lazy" class="image-style-test-uri" />', $this->getImageTag($variables)); - $this->assertFileNotExists($generated_uri); + $this->assertFileDoesNotExist($generated_uri); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertSession()->statusCodeEquals(200); $this->assertFileExists($generated_uri); @@ -282,7 +282,7 @@ public function testImageDimensions() { $url = file_url_transform_relative($style->buildUrl($original_uri)); $variables['#uri'] = $original_uri; $this->assertEquals('<img src="' . $url . '" width="50" height="50" alt="" loading="lazy" class="image-style-test-uri" />', $this->getImageTag($variables)); - $this->assertFileNotExists($generated_uri); + $this->assertFileDoesNotExist($generated_uri); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertSession()->statusCodeEquals(200); $this->assertFileExists($generated_uri); diff --git a/core/modules/image/tests/src/Functional/ImageEffect/ConvertTest.php b/core/modules/image/tests/src/Functional/ImageEffect/ConvertTest.php index e926f3cd67ff..e404e79550b3 100644 --- a/core/modules/image/tests/src/Functional/ImageEffect/ConvertTest.php +++ b/core/modules/image/tests/src/Functional/ImageEffect/ConvertTest.php @@ -48,7 +48,7 @@ public function testConvertFileInRoot() { // Execute the image style on the test image via a GET request. $derivative_uri = 'public://styles/image_effect_test/public/image-test-do.png.jpeg'; - $this->assertFileNotExists($derivative_uri); + $this->assertFileDoesNotExist($derivative_uri); $url = file_url_transform_relative($image_style->buildUrl($test_uri)); $this->drupalGet($this->getAbsoluteUrl($url)); $this->assertSession()->statusCodeEquals(200); diff --git a/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php b/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php index f5da8392f36c..0124dfd2bea3 100644 --- a/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php +++ b/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php @@ -63,7 +63,7 @@ public function testValid() { ]; $this->drupalGet('node/' . $node . '/edit'); $this->submitForm($edit, 'Upload'); - $this->assertFileNotExists($expected_path . '/' . $zero_size_image->filename); + $this->assertFileDoesNotExist($expected_path . '/' . $zero_size_image->filename); // Try uploading an invalid image. $invalid_image = $invalid_image_files['invalid-img-test.png']; @@ -72,7 +72,7 @@ public function testValid() { ]; $this->drupalGet('node/' . $node . '/edit'); $this->submitForm($edit, 'Upload'); - $this->assertFileNotExists($expected_path . '/' . $invalid_image->filename); + $this->assertFileDoesNotExist($expected_path . '/' . $invalid_image->filename); // Upload a valid image again. $valid_image = $image_files[0]; diff --git a/core/modules/image/tests/src/Functional/ImageStylesPathAndUrlTest.php b/core/modules/image/tests/src/Functional/ImageStylesPathAndUrlTest.php index fd388153b63f..9ce52c6ca648 100644 --- a/core/modules/image/tests/src/Functional/ImageStylesPathAndUrlTest.php +++ b/core/modules/image/tests/src/Functional/ImageStylesPathAndUrlTest.php @@ -164,7 +164,7 @@ public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_s // Get the URL of a file that has not been generated and try to create it. $generated_uri = $this->style->buildUri($original_uri); - $this->assertFileNotExists($generated_uri); + $this->assertFileDoesNotExist($generated_uri); $generate_url = $this->style->buildUrl($original_uri, $clean_url); // Make sure that language prefix is never added to the image style URL. @@ -243,7 +243,7 @@ public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_s $file_noaccess = array_shift($files); $original_uri_noaccess = $file_system->copy($file_noaccess->uri, $scheme . '://', FileSystemInterface::EXISTS_RENAME); $generated_uri_noaccess = $scheme . '://styles/' . $this->style->id() . '/' . $scheme . '/' . $file_system->basename($original_uri_noaccess); - $this->assertFileNotExists($generated_uri_noaccess); + $this->assertFileDoesNotExist($generated_uri_noaccess); $generate_url_noaccess = $this->style->buildUrl($original_uri_noaccess); $this->drupalGet($generate_url_noaccess); @@ -291,7 +291,7 @@ public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_s // is not present in the URL but that the image is still accessible. $this->config('image.settings')->set('suppress_itok_output', TRUE)->save(); $generated_uri = $this->style->buildUri($original_uri); - $this->assertFileNotExists($generated_uri); + $this->assertFileDoesNotExist($generated_uri); $generate_url = $this->style->buildUrl($original_uri, $clean_url); $this->assertStringNotContainsString(IMAGE_DERIVATIVE_TOKEN . '=', $generate_url, 'The security token does not appear in the image style URL.'); $this->drupalGet($generate_url); diff --git a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php index e0c240801780..34e0ae2bbe92 100644 --- a/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php +++ b/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php @@ -501,7 +501,7 @@ public function testFileUploadStrippedFilePath() { // Check the actual file data. It should have been written to the configured // directory, not /foobar/directory/example.txt. $this->assertSame($this->testFileData, file_get_contents('public://foobar/example_2.txt')); - $this->assertFileNotExists('../../example_2.txt'); + $this->assertFileDoesNotExist('../../example_2.txt'); // Check a path from the root. Extensions have to be empty to allow a file // with no extension to pass validation. @@ -575,7 +575,7 @@ public function testFileUploadInvalidFileType() { // Make sure that no file was saved. $this->assertEmpty(File::load(1)); - $this->assertFileNotExists('public://foobar/example.txt'); + $this->assertFileDoesNotExist('public://foobar/example.txt'); } /** @@ -598,7 +598,7 @@ public function testFileUploadLargerFileSize() { // Make sure that no file was saved. $this->assertEmpty(File::load(1)); - $this->assertFileNotExists('public://foobar/example.txt'); + $this->assertFileDoesNotExist('public://foobar/example.txt'); } /** @@ -638,7 +638,7 @@ public function testFileUploadMaliciousExtension() { $expected['data']['attributes']['filesize'] = strlen($php_string); $this->assertResponseData($expected, $response); $this->assertFileExists('public://foobar/example_2.php_.txt'); - $this->assertFileNotExists('public://foobar/example_2.php'); + $this->assertFileDoesNotExist('public://foobar/example_2.php'); // Allow .doc file uploads and ensure even a mis-configured apache will not // fallback to php because the filename will be munged. @@ -655,7 +655,7 @@ public function testFileUploadMaliciousExtension() { $expected['data']['attributes']['filemime'] = 'application/msword'; $this->assertResponseData($expected, $response); $this->assertFileExists('public://foobar/example_3.php_.doc'); - $this->assertFileNotExists('public://foobar/example_3.php.doc'); + $this->assertFileDoesNotExist('public://foobar/example_3.php.doc'); // Test that a dangerous extension such as .php is munged even if it is in // the list of allowed extensions. @@ -672,7 +672,7 @@ public function testFileUploadMaliciousExtension() { $expected['data']['attributes']['filemime'] = 'application/msword'; $this->assertResponseData($expected, $response); $this->assertFileExists('public://foobar/example_4.php_.doc'); - $this->assertFileNotExists('public://foobar/example_4.php.doc'); + $this->assertFileDoesNotExist('public://foobar/example_4.php.doc'); // Dangerous extensions are munged even when all extensions are allowed. $this->field->setSetting('file_extensions', '')->save(); @@ -705,8 +705,8 @@ public function testFileUploadMaliciousExtension() { $this->assertResourceErrorResponse(422, "Unprocessable Entity: file validation failed.\nFor security reasons, your upload has been rejected.", $uri, $response); // Make sure that no file was saved. - $this->assertFileNotExists('public://foobar/example_7.php'); - $this->assertFileNotExists('public://foobar/example_7.php.txt'); + $this->assertFileDoesNotExist('public://foobar/example_7.php'); + $this->assertFileDoesNotExist('public://foobar/example_7.php.txt'); // Now allow insecure uploads. \Drupal::configFactory() diff --git a/core/modules/locale/tests/src/Functional/LocaleTranslationDownloadTest.php b/core/modules/locale/tests/src/Functional/LocaleTranslationDownloadTest.php index 27eea7f67a7d..355e204e7a50 100644 --- a/core/modules/locale/tests/src/Functional/LocaleTranslationDownloadTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleTranslationDownloadTest.php @@ -62,7 +62,7 @@ public function testUpdateImportSourceRemote() { $result = locale_translation_download_source($source_file, 'translations://'); $this->assertEquals('translations://contrib_module_one-8.x-1.1.de._po', $result->uri); - $this->assertFileNotExists('translations://contrib_module_one-8.x-1.1.de_0._po'); + $this->assertFileDoesNotExist('translations://contrib_module_one-8.x-1.1.de_0._po'); $this->assertFileExists('translations://contrib_module_one-8.x-1.1.de._po'); $this->assertStringNotContainsString('__old_content__', file_get_contents('translations://contrib_module_one-8.x-1.1.de._po')); } diff --git a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php index 5c5a19457c5b..d0ea227b8052 100644 --- a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php @@ -311,7 +311,7 @@ public function testJavaScriptTranslation() { // Test JavaScript translation rebuilding. \Drupal::service('file_system')->delete($js_file); - $this->assertFileNotExists($js_file); + $this->assertFileDoesNotExist($js_file); _locale_rebuild_js($langcode); $this->assertFileExists($js_file); } diff --git a/core/modules/media_library/tests/src/FunctionalJavascript/WidgetUploadTest.php b/core/modules/media_library/tests/src/FunctionalJavascript/WidgetUploadTest.php index d928298a8f8e..bb12a63ef21b 100644 --- a/core/modules/media_library/tests/src/FunctionalJavascript/WidgetUploadTest.php +++ b/core/modules/media_library/tests/src/FunctionalJavascript/WidgetUploadTest.php @@ -315,7 +315,7 @@ public function testWidgetUpload() { $this->assertJsCondition('jQuery("[data-media-library-added-delta=2]").is(":focus")'); // Assert the file was deleted. $this->assertEmpty($file_storage->loadByProperties(['filename' => $filenames[1]])); - $this->assertFileNotExists($file_1_uri); + $this->assertFileDoesNotExist($file_1_uri); // When a file is already in usage, it should not be deleted. To test, // let's add a usage for $filenames[3] (now in the third position). @@ -684,7 +684,7 @@ public function testWidgetUploadAdvancedUi() { $assert_session->pageTextContains('The media item ' . $filenames[1] . ' has been removed.'); // Assert the file was deleted. $this->assertEmpty($file_storage->loadByProperties(['filename' => $filenames[1]])); - $this->assertFileNotExists($file_1_uri); + $this->assertFileDoesNotExist($file_1_uri); // When a file is already in usage, it should not be deleted. To test, // let's add a usage for $filenames[3] (now in the third position). diff --git a/core/modules/migrate/tests/src/Kernel/process/DownloadTest.php b/core/modules/migrate/tests/src/Kernel/process/DownloadTest.php index 94c4a93e95bb..aa2d7c911b7c 100644 --- a/core/modules/migrate/tests/src/Kernel/process/DownloadTest.php +++ b/core/modules/migrate/tests/src/Kernel/process/DownloadTest.php @@ -40,7 +40,7 @@ public function testOverwritingDownload() { // Test destructive download. $actual_destination = $this->doTransform($destination_uri); $this->assertSame($destination_uri, $actual_destination, 'Import returned a destination that was not renamed'); - $this->assertFileNotExists('public://existing_file_0.txt'); + $this->assertFileDoesNotExist('public://existing_file_0.txt'); } /** diff --git a/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php b/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php index bf4ba8cd18e4..469f6540ee45 100644 --- a/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php +++ b/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php @@ -152,7 +152,7 @@ public function testSuccessfulMoves() { list($source_path, $destination_path) = $data; $actual_destination = $this->doTransform($source_path, $destination_path, ['move' => TRUE]); $this->assertFileExists($destination_path); - $this->assertFileNotExists($source_path); + $this->assertFileDoesNotExist($source_path); $this->assertSame($actual_destination, $destination_path, 'The importer returned the moved filename.'); } } diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php index 6565ec7c4dc1..cb9eeb21dd30 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php @@ -350,7 +350,7 @@ protected function assertFileMigrations() { $scheme = $matches[1]; $filepath = $fs->realpath($file['uri']); if ($scheme === 'temporary') { - $this->assertFileNotExists($filepath); + $this->assertFileDoesNotExist($filepath); } else { $this->assertFileExists($filepath); diff --git a/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php b/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php index a1c4a74f8db9..c5381d5cdcdb 100644 --- a/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php @@ -383,7 +383,7 @@ public function testFileUploadStrippedFilePath() { // Check the actual file data. It should have been written to the configured // directory, not /foobar/directory/example.txt. $this->assertSame($this->testFileData, file_get_contents('public://foobar/example_2.txt')); - $this->assertFileNotExists('../../example_2.txt'); + $this->assertFileDoesNotExist('../../example_2.txt'); // Check a path from the root. Extensions have to be empty to allow a file // with no extension to pass validation. @@ -466,7 +466,7 @@ public function testFileUploadInvalidFileType() { // Make sure that no file was saved. $this->assertEmpty(File::load(1)); - $this->assertFileNotExists('public://foobar/example.txt'); + $this->assertFileDoesNotExist('public://foobar/example.txt'); } /** @@ -492,7 +492,7 @@ public function testFileUploadLargerFileSize() { // Make sure that no file was saved. $this->assertEmpty(File::load(1)); - $this->assertFileNotExists('public://foobar/example.txt'); + $this->assertFileDoesNotExist('public://foobar/example.txt'); } /** @@ -534,7 +534,7 @@ public function testFileUploadMaliciousExtension() { $expected['filesize'][0]['value'] = strlen($php_string); $this->assertResponseData($expected, $response); $this->assertFileExists('public://foobar/example_2.php_.txt'); - $this->assertFileNotExists('public://foobar/example_2.php'); + $this->assertFileDoesNotExist('public://foobar/example_2.php'); // Allow .doc file uploads and ensure even a mis-configured apache will not // fallback to php because the filename will be munged. @@ -551,7 +551,7 @@ public function testFileUploadMaliciousExtension() { $expected['filemime'][0]['value'] = 'application/msword'; $this->assertResponseData($expected, $response); $this->assertFileExists('public://foobar/example_3.php_.doc'); - $this->assertFileNotExists('public://foobar/example_3.php.doc'); + $this->assertFileDoesNotExist('public://foobar/example_3.php.doc'); // Test that a dangerous extension such as .php is munged even if it is in // the list of allowed extensions. @@ -568,7 +568,7 @@ public function testFileUploadMaliciousExtension() { $expected['filemime'][0]['value'] = 'application/msword'; $this->assertResponseData($expected, $response); $this->assertFileExists('public://foobar/example_4.php_.doc'); - $this->assertFileNotExists('public://foobar/example_4.php.doc'); + $this->assertFileDoesNotExist('public://foobar/example_4.php.doc'); // Dangerous extensions are munged even when all extensions are allowed. $this->field->setSetting('file_extensions', '')->save(); @@ -601,8 +601,8 @@ public function testFileUploadMaliciousExtension() { $this->assertResourceErrorResponse(422, "Unprocessable Entity: file validation failed.\nFor security reasons, your upload has been rejected.", $response); // Make sure that no file was saved. - $this->assertFileNotExists('public://foobar/example_7.php'); - $this->assertFileNotExists('public://foobar/example_7.php.txt'); + $this->assertFileDoesNotExist('public://foobar/example_7.php'); + $this->assertFileDoesNotExist('public://foobar/example_7.php.txt'); // Now allow insecure uploads. \Drupal::configFactory() diff --git a/core/modules/update/tests/src/Functional/UpdateUploadTest.php b/core/modules/update/tests/src/Functional/UpdateUploadTest.php index 2654868081fb..268598a1ad0d 100644 --- a/core/modules/update/tests/src/Functional/UpdateUploadTest.php +++ b/core/modules/update/tests/src/Functional/UpdateUploadTest.php @@ -79,7 +79,7 @@ public function testUploadModule() { $updaters = drupal_get_updaters(); $moduleUpdater = $updaters['module']['class']; $installedInfoFilePath = $this->container->get('update.root') . '/' . $moduleUpdater::getRootDirectoryRelativePath() . '/update_test_new_module/update_test_new_module.info.yml'; - $this->assertFileNotExists($installedInfoFilePath); + $this->assertFileDoesNotExist($installedInfoFilePath); $validArchiveFile = __DIR__ . '/../../update_test_new_module/8.x-1.0/update_test_new_module.tar.gz'; $edit = [ 'files[project_upload]' => $validArchiveFile, diff --git a/core/modules/update/tests/src/Kernel/UpdateDeleteFileIfStaleTest.php b/core/modules/update/tests/src/Kernel/UpdateDeleteFileIfStaleTest.php index f5a9b099f5f6..4b5118c8e9f5 100644 --- a/core/modules/update/tests/src/Kernel/UpdateDeleteFileIfStaleTest.php +++ b/core/modules/update/tests/src/Kernel/UpdateDeleteFileIfStaleTest.php @@ -51,7 +51,7 @@ public function testUpdateDeleteFileIfStale() { // attempt should succeed. $deleted = update_delete_file_if_stale($file_path); $this->assertTrue($deleted); - $this->assertFileNotExists($file_path); + $this->assertFileDoesNotExist($file_path); } } diff --git a/core/modules/user/tests/src/Functional/UserPictureTest.php b/core/modules/user/tests/src/Functional/UserPictureTest.php index 4878fe624829..b20c9b4c7eb5 100644 --- a/core/modules/user/tests/src/Functional/UserPictureTest.php +++ b/core/modules/user/tests/src/Functional/UserPictureTest.php @@ -96,7 +96,7 @@ public function testCreateDeletePicture() { $this->assertNull(File::load($file->id()), 'File was removed from the database.'); // Clear out PHP's file stat cache so we see the current value. clearstatcache(TRUE, $file->getFileUri()); - $this->assertFileNotExists($file->getFileUri()); + $this->assertFileDoesNotExist($file->getFileUri()); } /** diff --git a/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php index 8e87252b9383..e3cabaffd9de 100644 --- a/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php +++ b/core/tests/Drupal/BuildTests/Composer/Template/ComposerProjectTemplatesTest.php @@ -203,7 +203,7 @@ public function testTemplateCreateProject($project, $package_dir, $docroot_dir) $installed_composer_json = $this->getWorkspaceDirectory() . '/testproject/composer.json'; $autoloader = $this->getWorkspaceDirectory() . '/testproject' . $docroot_dir . '/autoload.php'; - $this->assertFileNotExists($autoloader); + $this->assertFileDoesNotExist($autoloader); $this->executeCommand("COMPOSER_HOME=$composer_home COMPOSER_ROOT_VERSION=$simulated_core_version composer create-project --no-ansi $project testproject $simulated_core_version -vvv --repository $repository_path"); $this->assertCommandSuccessful(); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FormValuesTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FormValuesTest.php index d23c91653b99..7fbbe05403d5 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FormValuesTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/FormValuesTest.php @@ -61,7 +61,7 @@ public function testSimpleAjaxFormValue() { // Verify that AJAX elements with invalid callbacks return error code 500. // Ensure the test error log is empty before these tests. - $this->assertFileNotExists(DRUPAL_ROOT . '/' . $this->siteDirectory . '/error.log'); + $this->assertFileDoesNotExist(DRUPAL_ROOT . '/' . $this->siteDirectory . '/error.log'); // We don't need to check for the X-Drupal-Ajax-Token header with these // invalid requests. $this->assertAjaxHeader = FALSE; diff --git a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php index 5323d2511a7c..117190960dab 100644 --- a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php +++ b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php @@ -314,7 +314,7 @@ protected function assertErrorLogged($error_message) { protected function assertNoErrorsLogged() { // Since PHP only creates the error.log file when an actual error is // triggered, it is sufficient to check whether the file exists. - $this->assertFileNotExists(DRUPAL_ROOT . '/' . $this->siteDirectory . '/error.log'); + $this->assertFileDoesNotExist(DRUPAL_ROOT . '/' . $this->siteDirectory . '/error.log'); } } diff --git a/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php b/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php index d6105f578780..75eda0a9bd37 100644 --- a/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php @@ -97,13 +97,13 @@ public function testFileCheckDirectoryHandling() { // Remove .htaccess file to then test that it gets re-created. @$file_system->unlink($default_scheme . '://.htaccess'); - $this->assertFileNotExists($default_scheme . '://.htaccess'); + $this->assertFileDoesNotExist($default_scheme . '://.htaccess'); $this->container->get('file.htaccess_writer')->ensure(); $this->assertFileExists($default_scheme . '://.htaccess'); // Remove .htaccess file again to test that it is re-created by a cron run. @$file_system->unlink($default_scheme . '://.htaccess'); - $this->assertFileNotExists($default_scheme . '://.htaccess'); + $this->assertFileDoesNotExist($default_scheme . '://.htaccess'); system_cron(); $this->assertFileExists($default_scheme . '://.htaccess'); diff --git a/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php b/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php index fefd83fdc89d..525b95fc8eb6 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileCopyTest.php @@ -51,7 +51,7 @@ public function testNormal() { public function testNonExistent() { // Copy non-existent file $desired_filepath = $this->randomMachineName(); - $this->assertFileNotExists($desired_filepath); + $this->assertFileDoesNotExist($desired_filepath); $this->expectException(FileNotExistsException::class); $new_filepath = \Drupal::service('file_system')->copy($desired_filepath, $this->randomMachineName()); $this->assertFalse($new_filepath, 'Copying a missing file fails.'); diff --git a/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php b/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php index 224fcab96b42..10f17b0b1875 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileDeleteRecursiveTest.php @@ -19,7 +19,7 @@ public function testSingleFile() { // Delete the file. $this->assertTrue(\Drupal::service('file_system')->deleteRecursive($filepath), 'Function reported success.'); - $this->assertFileNotExists($filepath); + $this->assertFileDoesNotExist($filepath); } /** @@ -47,8 +47,8 @@ public function testDirectory() { // Delete the directory. $this->assertTrue(\Drupal::service('file_system')->deleteRecursive($directory), 'Function reported success.'); - $this->assertFileNotExists($filepathA); - $this->assertFileNotExists($filepathB); + $this->assertFileDoesNotExist($filepathA); + $this->assertFileDoesNotExist($filepathB); $this->assertDirectoryDoesNotExist($directory); } @@ -66,8 +66,8 @@ public function testSubDirectory() { // Delete the directory. $this->assertTrue(\Drupal::service('file_system')->deleteRecursive($directory), 'Function reported success.'); - $this->assertFileNotExists($filepathA); - $this->assertFileNotExists($filepathB); + $this->assertFileDoesNotExist($filepathA); + $this->assertFileDoesNotExist($filepathB); $this->assertDirectoryDoesNotExist($subdirectory); $this->assertDirectoryDoesNotExist($directory); } diff --git a/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php b/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php index e60d952c7cd9..8c1c925b6277 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileDeleteTest.php @@ -20,7 +20,7 @@ public function testNormal() { // Delete a regular file $this->assertTrue(\Drupal::service('file_system')->delete($uri), 'Deleted worked.'); - $this->assertFileNotExists($uri); + $this->assertFileDoesNotExist($uri); } /** diff --git a/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php b/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php index e4b712ebc4db..6e91feddcc5b 100644 --- a/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/FileMoveTest.php @@ -30,7 +30,7 @@ public function testNormal() { $this->assertNotFalse($new_filepath, 'Move was successful.'); $this->assertEquals($desired_filepath, $new_filepath, 'Returned expected filepath.'); $this->assertFileExists($new_filepath); - $this->assertFileNotExists($uri); + $this->assertFileDoesNotExist($uri); $this->assertFilePermissions($new_filepath, Settings::get('file_chmod_file', FileSystem::CHMOD_FILE)); // Moving with rename. @@ -41,7 +41,7 @@ public function testNormal() { $this->assertNotFalse($newer_filepath, 'Move was successful.'); $this->assertNotEquals($desired_filepath, $newer_filepath, 'Returned expected filepath.'); $this->assertFileExists($newer_filepath); - $this->assertFileNotExists($new_filepath); + $this->assertFileDoesNotExist($new_filepath); $this->assertFilePermissions($newer_filepath, Settings::get('file_chmod_file', FileSystem::CHMOD_FILE)); // TODO: test moving to a directory (rather than full directory/file path) @@ -75,7 +75,7 @@ public function testOverwriteSelf() { // Move the file onto itself with renaming will result in a new filename. $new_filepath = $file_system->move($uri, $uri, FileSystemInterface::EXISTS_RENAME); $this->assertNotFalse($new_filepath, 'Moving onto itself with renaming works.'); - $this->assertFileNotExists($uri); + $this->assertFileDoesNotExist($uri); $this->assertFileExists($new_filepath); } diff --git a/core/tests/Drupal/KernelTests/Core/File/PharWrapperTest.php b/core/tests/Drupal/KernelTests/Core/File/PharWrapperTest.php index fd53d27e949e..98544121f237 100644 --- a/core/tests/Drupal/KernelTests/Core/File/PharWrapperTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/PharWrapperTest.php @@ -18,7 +18,7 @@ public function testPharFile() { $base = $this->getDrupalRoot() . '/core/tests/fixtures/files'; // Ensure that file operations via the phar:// stream wrapper work for phar // files with the .phar extension. - $this->assertFileNotExists("phar://$base/phar-1.phar/no-such-file.php"); + $this->assertFileDoesNotExist("phar://$base/phar-1.phar/no-such-file.php"); $this->assertFileExists("phar://$base/phar-1.phar/index.php"); $file_contents = file_get_contents("phar://$base/phar-1.phar/index.php"); $expected_hash = 'c7e7904ea573c5ebea3ef00bb08c1f86af1a45961fbfbeb1892ff4a98fd73ad5'; diff --git a/core/tests/Drupal/KernelTests/Core/Test/EnvironmentCleanerTest.php b/core/tests/Drupal/KernelTests/Core/Test/EnvironmentCleanerTest.php index f0f35586bae1..86de3b3b5a8a 100644 --- a/core/tests/Drupal/KernelTests/Core/Test/EnvironmentCleanerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Test/EnvironmentCleanerTest.php @@ -48,8 +48,8 @@ public function testDoCleanTemporaryDirectories() { $this->assertEquals(2, $do_cleanup_ref->invoke($cleaner)); $this->assertDirectoryDoesNotExist(vfsStream::url('cleanup_test/sites/simpletest/delete_dir')); - $this->assertFileNotExists(vfsStream::url('cleanup_test/sites/simpletest/delete_dir/delete.me')); - $this->assertFileNotExists(vfsStream::url('cleanup_test/sites/simpletest/delete_me.too')); + $this->assertFileDoesNotExist(vfsStream::url('cleanup_test/sites/simpletest/delete_dir/delete.me')); + $this->assertFileDoesNotExist(vfsStream::url('cleanup_test/sites/simpletest/delete_me.too')); } } diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php index f2bbd19248ee..924005304d34 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php @@ -55,7 +55,7 @@ public function testDefaultConfig() { public function testNoDefaultConfig() { $name = 'stark'; $path = $this->availableThemes[$name]->getPath(); - $this->assertFileNotExists("$path/" . InstallStorage::CONFIG_INSTALL_DIRECTORY . "/$name.settings.yml"); + $this->assertFileDoesNotExist("$path/" . InstallStorage::CONFIG_INSTALL_DIRECTORY . "/$name.settings.yml"); $this->container->get('theme_installer')->install([$name]); $this->assertNotNull(theme_get_setting('features.favicon', $name)); } diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ComposerHookTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ComposerHookTest.php index fb5651b16b1d..372ba0dee39a 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ComposerHookTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ComposerHookTest.php @@ -89,20 +89,20 @@ public function testComposerHooks() { // Delete one scaffold file, just for test purposes, then run // 'composer update' and see if the scaffold file is replaced. @unlink($sut . '/sites/default/default.settings.php'); - $this->assertFileNotExists($sut . '/sites/default/default.settings.php'); + $this->assertFileDoesNotExist($sut . '/sites/default/default.settings.php'); $this->mustExec("composer update --no-ansi", $sut); $this->assertScaffoldedFile($sut . '/sites/default/default.settings.php', FALSE, 'scaffolded from the scaffold-override-fixture'); // Delete the same test scaffold file again, then run // 'composer drupal:scaffold' and see if the scaffold file is // re-scaffolded. @unlink($sut . '/sites/default/default.settings.php'); - $this->assertFileNotExists($sut . '/sites/default/default.settings.php'); + $this->assertFileDoesNotExist($sut . '/sites/default/default.settings.php'); $this->mustExec("composer install --no-ansi", $sut); $this->assertScaffoldedFile($sut . '/sites/default/default.settings.php', FALSE, 'scaffolded from the scaffold-override-fixture'); // Delete the same test scaffold file yet again, then run // 'composer install' and see if the scaffold file is re-scaffolded. @unlink($sut . '/sites/default/default.settings.php'); - $this->assertFileNotExists($sut . '/sites/default/default.settings.php'); + $this->assertFileDoesNotExist($sut . '/sites/default/default.settings.php'); $this->mustExec("composer drupal:scaffold --no-ansi", $sut); $this->assertScaffoldedFile($sut . '/sites/default/default.settings.php', FALSE, 'scaffolded from the scaffold-override-fixture'); // Run 'composer create-project' to create a new test project called @@ -121,7 +121,7 @@ public function testComposerHooks() { // Require a project that is not allowed to scaffold and confirm that we // get a warning, and it does not scaffold. $stdout = $this->mustExec("composer require --no-ansi --no-interaction fixtures/scaffold-override-fixture:dev-master", $sut); - $this->assertFileNotExists($sut . '/sites/default/default.settings.php'); + $this->assertFileDoesNotExist($sut . '/sites/default/default.settings.php'); $this->assertStringContainsString("Not scaffolding files for fixtures/scaffold-override-fixture, because it is not listed in the element 'extra.drupal-scaffold.allowed-packages' in the root-level composer.json file.", $stdout); } diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php index 7ea7e90d313c..dee14dfcf4a3 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php @@ -104,9 +104,9 @@ public function testManageGitIgnore() { // Note that the drupal-composer-drupal-project fixture does not // have any configuration settings related to .gitignore management. $sut = $this->createSutWithGit('drupal-composer-drupal-project'); - $this->assertFileNotExists($sut . '/docroot/autoload.php'); - $this->assertFileNotExists($sut . '/docroot/index.php'); - $this->assertFileNotExists($sut . '/docroot/sites/.gitignore'); + $this->assertFileDoesNotExist($sut . '/docroot/autoload.php'); + $this->assertFileDoesNotExist($sut . '/docroot/index.php'); + $this->assertFileDoesNotExist($sut . '/docroot/sites/.gitignore'); // Run the scaffold command. $this->fixtures->runScaffold($sut); $this->assertFileExists($sut . '/docroot/autoload.php'); @@ -149,14 +149,14 @@ public function testUnmanagedGitIgnoreWhenDisabled() { // Note that the drupal-drupal fixture has a configuration setting // `"gitignore": false,` which disables .gitignore file handling. $sut = $this->createSutWithGit('drupal-drupal'); - $this->assertFileNotExists($sut . '/docroot/autoload.php'); - $this->assertFileNotExists($sut . '/docroot/index.php'); + $this->assertFileDoesNotExist($sut . '/docroot/autoload.php'); + $this->assertFileDoesNotExist($sut . '/docroot/index.php'); // Run the scaffold command. $this->fixtures->runScaffold($sut); $this->assertFileExists($sut . '/autoload.php'); $this->assertFileExists($sut . '/index.php'); - $this->assertFileNotExists($sut . '/.gitignore'); - $this->assertFileNotExists($sut . '/docroot/sites/default/.gitignore'); + $this->assertFileDoesNotExist($sut . '/.gitignore'); + $this->assertFileDoesNotExist($sut . '/docroot/sites/default/.gitignore'); } /** @@ -168,9 +168,9 @@ public function testUnmanagedGitIgnoreWhenDisabled() { */ public function testAppendToEmptySettingsIsUnmanaged() { $sut = $this->createSutWithGit('drupal-drupal-append-settings'); - $this->assertFileNotExists($sut . '/autoload.php'); - $this->assertFileNotExists($sut . '/index.php'); - $this->assertFileNotExists($sut . '/sites/.gitignore'); + $this->assertFileDoesNotExist($sut . '/autoload.php'); + $this->assertFileDoesNotExist($sut . '/index.php'); + $this->assertFileDoesNotExist($sut . '/sites/.gitignore'); // Run the scaffold command. $this->fixtures->runScaffold($sut); $this->assertFileExists($sut . '/autoload.php'); @@ -190,9 +190,9 @@ public function testUnmanagedGitIgnoreWhenGitNotAvailable() { // Note that the drupal-composer-drupal-project fixture does not have any // configuration settings related to .gitignore management. $sut = $this->createSutWithGit('drupal-composer-drupal-project'); - $this->assertFileNotExists($sut . '/docroot/sites/default/.gitignore'); - $this->assertFileNotExists($sut . '/docroot/index.php'); - $this->assertFileNotExists($sut . '/docroot/sites/.gitignore'); + $this->assertFileDoesNotExist($sut . '/docroot/sites/default/.gitignore'); + $this->assertFileDoesNotExist($sut . '/docroot/index.php'); + $this->assertFileDoesNotExist($sut . '/docroot/sites/.gitignore'); // Confirm that 'git' is available (n.b. if it were not, createSutWithGit() // would fail). $output = []; @@ -243,7 +243,7 @@ public function testUnmanagedGitIgnoreWhenGitNotAvailable() { EOT; $this->assertEquals($expected, $status . "\n\n" . implode("\n", $output)); $this->assertFileExists($sut . '/docroot/index.php'); - $this->assertFileNotExists($sut . '/docroot/sites/default/.gitignore'); + $this->assertFileDoesNotExist($sut . '/docroot/sites/default/.gitignore'); } } diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php index 77ab06c3a768..2ae7e60f7a8e 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ScaffoldTest.php @@ -124,7 +124,7 @@ public function scaffoldSut($fixture_name, $is_link = FALSE, $relocated_docroot $this->assertFileExists($docroot); } else { - $this->assertFileNotExists($sut . '/docroot'); + $this->assertFileDoesNotExist($sut . '/docroot'); } return new ScaffoldTestResult($docroot, $scaffoldOutput); @@ -370,7 +370,7 @@ protected function assertDefaultSettingsFromScaffoldOverride($docroot, $is_link) protected function assertHtaccessExcluded($docroot) { // Ensure that the .htaccess.txt file was not written, as our // top-level composer.json excludes it from the files to scaffold. - $this->assertFileNotExists($docroot . '/.htaccess'); + $this->assertFileDoesNotExist($docroot . '/.htaccess'); } /** diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/AppendOpTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/AppendOpTest.php index ff189a37880b..b113afa3220c 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/AppendOpTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/AppendOpTest.php @@ -24,7 +24,7 @@ public function testProcess() { $destination = $fixtures->destinationPath('[web-root]/robots.txt'); $options = ScaffoldOptions::create([]); // Assert that there is no target file before we run our test. - $this->assertFileNotExists($destination->fullPath()); + $this->assertFileDoesNotExist($destination->fullPath()); // Create a file. file_put_contents($destination->fullPath(), "# This is a test\n"); diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php index 65de3c77c057..0d3ef35fdb46 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php @@ -26,7 +26,7 @@ public function testProcess() { $options = ScaffoldOptions::create([]); $sut = new ReplaceOp($source, TRUE); // Assert that there is no target file before we run our test. - $this->assertFileNotExists($destination->fullPath()); + $this->assertFileDoesNotExist($destination->fullPath()); // Test the system under test. $sut->process($destination, $fixtures->io(), $options); // Assert that the target file was created. diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/SkipOpTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/SkipOpTest.php index f2cb6cbd6e88..3f90f79bad1b 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/SkipOpTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/SkipOpTest.php @@ -25,11 +25,11 @@ public function testProcess() { $options = ScaffoldOptions::create([]); $sut = new SkipOp(); // Assert that there is no target file before we run our test. - $this->assertFileNotExists($destination->fullPath()); + $this->assertFileDoesNotExist($destination->fullPath()); // Test the system under test. $sut->process($destination, $fixtures->io(), $options); // Assert that the target file was not created. - $this->assertFileNotExists($destination->fullPath()); + $this->assertFileDoesNotExist($destination->fullPath()); // Confirm that expected output was written to our io fixture. $output = $fixtures->getOutput(); $this->assertStringContainsString('Skip [web-root]/robots.txt: disabled', $output); diff --git a/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php b/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php index c8d2d17f80d2..f73242e88917 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php @@ -70,7 +70,7 @@ public function testCleanPackage() { $plugin->cleanPackage($package->reveal()); - $this->assertFileNotExists(vfsStream::url('vendor/drupal/package/tests')); + $this->assertFileDoesNotExist(vfsStream::url('vendor/drupal/package/tests')); } /** @@ -98,7 +98,7 @@ public function testCleanPathsForPackage() { $ref_clean->setAccessible(TRUE); $ref_clean->invokeArgs($plugin, [$package->reveal(), ['tests']]); - $this->assertFileNotExists(vfsStream::url('vendor/drupal/package/tests')); + $this->assertFileDoesNotExist(vfsStream::url('vendor/drupal/package/tests')); } /** @@ -141,7 +141,7 @@ public function testCleanAllPackages() { $plugin->cleanAllPackages(); - $this->assertFileNotExists(vfsStream::url('vendor/drupal/package/tests')); + $this->assertFileDoesNotExist(vfsStream::url('vendor/drupal/package/tests')); } /** @@ -164,8 +164,8 @@ public function testWriteAccessRestrictionFiles() { $this->assertDirectoryExists($dir); - $this->assertFileNotExists($dir . '/.htaccess'); - $this->assertFileNotExists($dir . '/web.config'); + $this->assertFileDoesNotExist($dir . '/.htaccess'); + $this->assertFileDoesNotExist($dir . '/web.config'); $plugin->writeAccessRestrictionFiles($dir); diff --git a/core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php b/core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php index cf2194566667..067a2409d3e9 100644 --- a/core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php +++ b/core/tests/Drupal/Tests/Core/Command/GenerateThemeTest.php @@ -78,7 +78,7 @@ public function test() { $this->assertStringContainsString('Theme could not be generated because the destination directory', $process->getErrorOutput()); $this->assertStringContainsString($theme_path_relative, $process->getErrorOutput()); $this->assertSame(1, $result); - $this->assertFileNotExists($theme_path_absolute . '/test_custom_theme.theme'); + $this->assertFileDoesNotExist($theme_path_absolute . '/test_custom_theme.theme'); } } diff --git a/core/tests/Drupal/Tests/Core/File/FileSystemTest.php b/core/tests/Drupal/Tests/Core/File/FileSystemTest.php index a4b2b2aa51a2..1b5a49543ab3 100644 --- a/core/tests/Drupal/Tests/Core/File/FileSystemTest.php +++ b/core/tests/Drupal/Tests/Core/File/FileSystemTest.php @@ -99,7 +99,7 @@ public function testUnlink() { $this->assertFileExists($uri); $this->fileSystem->unlink($uri); - $this->assertFileNotExists($uri); + $this->assertFileDoesNotExist($uri); } /** diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php index d406a63b37f4..6fb6dd225cdf 100644 --- a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php +++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php @@ -125,7 +125,6 @@ public static function getSkippedDeprecations() { 'AssertLegacyTrait::assertNoRaw() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() instead. See https://www.drupal.org/node/3129738', // PHPUnit 9. "The \"PHPUnit\TextUI\DefaultResultPrinter\" class is considered internal This class is not covered by the backward compatibility promise for PHPUnit. It may change without further notice. You should not use it from \"Drupal\Tests\Listeners\HtmlOutputPrinter\".", - 'assertFileNotExists() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertFileDoesNotExist() instead.', 'The at() matcher has been deprecated. It will be removed in PHPUnit 10. Please refactor your test to not rely on the order in which methods are invoked.', ]; } diff --git a/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php b/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php index 5c6313929583..029830ac5125 100644 --- a/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php +++ b/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php @@ -172,7 +172,7 @@ public function testInstallScript() { // Ensure that all the tables and files for this DB prefix are gone. $this->assertCount(0, Database::getConnection('default', $key)->schema()->findTables('%')); - $this->assertFileNotExists($test_file); + $this->assertFileDoesNotExist($test_file); // Ensure the other site's tables and files still exist. $this->assertGreaterThan(0, count(Database::getConnection('default', $other_key)->schema()->findTables('%'))); @@ -194,12 +194,12 @@ public function testInstallScript() { // Ensure that all the tables and files for this DB prefix are gone. $this->assertCount(0, Database::getConnection('default', $other_key)->schema()->findTables('%')); - $this->assertFileNotExists($test_file); + $this->assertFileDoesNotExist($test_file); // The lock for the first site should still exist but the second site's lock // is released during tear down. $this->assertFileExists($this->getTestLockFile($db_prefix)); - $this->assertFileNotExists($this->getTestLockFile($other_db_prefix)); + $this->assertFileDoesNotExist($this->getTestLockFile($other_db_prefix)); } /** -- GitLab