From efef41faa17509a21fd10d3220ce0d205aedb35c Mon Sep 17 00:00:00 2001 From: Nyholm Date: Wed, 14 Oct 2020 09:00:24 +0200 Subject: [PATCH] [CI] Silence errors when remove file/dir on test tearDown() --- src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php | 2 +- .../FrameworkBundle/Tests/Command/YamlLintCommandTest.php | 4 ++-- src/Symfony/Component/Config/Tests/ConfigCacheTest.php | 2 +- .../Config/Tests/Resource/FileExistenceResourceTest.php | 2 +- .../Component/Config/Tests/Resource/FileResourceTest.php | 6 ++---- .../Config/Tests/ResourceCheckerConfigCacheTest.php | 2 +- .../Tests/Config/AutowireServiceResourceTest.php | 6 ++---- src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php | 4 ++-- .../Tests/Session/Storage/MockFileSessionStorageTest.php | 2 +- .../Tests/Session/Storage/NativeSessionStorageTest.php | 2 +- .../Tests/Session/Storage/PhpBridgeSessionStorageTest.php | 2 +- .../Validator/Tests/Constraints/FileValidatorTest.php | 2 +- .../Component/Yaml/Tests/Command/LintCommandTest.php | 4 ++-- 13 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php index 166f1d9c44..f03e87a4a8 100644 --- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php @@ -120,7 +120,7 @@ class LintCommandTest extends TestCase { foreach ($this->files as $file) { if (file_exists($file)) { - unlink($file); + @unlink($file); } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php index ba883543ca..3c88dc0a66 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php @@ -174,9 +174,9 @@ EOF; { foreach ($this->files as $file) { if (file_exists($file)) { - unlink($file); + @unlink($file); } } - rmdir(sys_get_temp_dir().'/yml-lint-test'); + @rmdir(sys_get_temp_dir().'/yml-lint-test'); } } diff --git a/src/Symfony/Component/Config/Tests/ConfigCacheTest.php b/src/Symfony/Component/Config/Tests/ConfigCacheTest.php index d0b70899b5..95a5881733 100644 --- a/src/Symfony/Component/Config/Tests/ConfigCacheTest.php +++ b/src/Symfony/Component/Config/Tests/ConfigCacheTest.php @@ -30,7 +30,7 @@ class ConfigCacheTest extends TestCase foreach ($files as $file) { if (file_exists($file)) { - unlink($file); + @unlink($file); } } } diff --git a/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php index 433f65e820..ff7fc7b5a3 100644 --- a/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php @@ -30,7 +30,7 @@ class FileExistenceResourceTest extends TestCase protected function tearDown() { if (file_exists($this->file)) { - unlink($this->file); + @unlink($this->file); } } diff --git a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php index 5b789700ad..a84faa956c 100644 --- a/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php @@ -30,11 +30,9 @@ class FileResourceTest extends TestCase protected function tearDown() { - if (!file_exists($this->file)) { - return; + if (file_exists($this->file)) { + @unlink($this->file); } - - unlink($this->file); } public function testGetResource() diff --git a/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php b/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php index a2c2eeb811..9be53196f4 100644 --- a/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php +++ b/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php @@ -31,7 +31,7 @@ class ResourceCheckerConfigCacheTest extends TestCase foreach ($files as $file) { if (file_exists($file)) { - unlink($file); + @unlink($file); } } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Config/AutowireServiceResourceTest.php b/src/Symfony/Component/DependencyInjection/Tests/Config/AutowireServiceResourceTest.php index 990a9ad663..3251550762 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Config/AutowireServiceResourceTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Config/AutowireServiceResourceTest.php @@ -103,11 +103,9 @@ class AutowireServiceResourceTest extends TestCase protected function tearDown() { - if (!file_exists($this->file)) { - return; + if (file_exists($this->file)) { + @unlink($this->file); } - - unlink($this->file); } private function getStaleFileTime() diff --git a/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php index 8eaf168a2d..5415dfb078 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/FileBagTest.php @@ -165,9 +165,9 @@ class FileBagTest extends TestCase protected function tearDown() { foreach (glob(sys_get_temp_dir().'/form_test/*') as $file) { - unlink($file); + @unlink($file); } - rmdir(sys_get_temp_dir().'/form_test'); + @rmdir(sys_get_temp_dir().'/form_test'); } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php index d6bd1823f4..73d154587a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php @@ -43,7 +43,7 @@ class MockFileSessionStorageTest extends TestCase { array_map('unlink', glob($this->sessionDir.'/*')); if (is_dir($this->sessionDir)) { - rmdir($this->sessionDir); + @rmdir($this->sessionDir); } $this->sessionDir = null; $this->storage = null; diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 7cfcd223e0..d86f56ebda 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -47,7 +47,7 @@ class NativeSessionStorageTest extends TestCase session_write_close(); array_map('unlink', glob($this->savePath.'/*')); if (is_dir($this->savePath)) { - rmdir($this->savePath); + @rmdir($this->savePath); } $this->savePath = null; diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php index 700764840d..e60b91b13c 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php @@ -43,7 +43,7 @@ class PhpBridgeSessionStorageTest extends TestCase session_write_close(); array_map('unlink', glob($this->savePath.'/*')); if (is_dir($this->savePath)) { - rmdir($this->savePath); + @rmdir($this->savePath); } $this->savePath = null; diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php index ae2f2b53a8..89a9941182 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php @@ -45,7 +45,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase } if (file_exists($this->path)) { - unlink($this->path); + @unlink($this->path); } $this->path = null; diff --git a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php index d19185f166..98c63b627c 100644 --- a/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Component/Yaml/Tests/Command/LintCommandTest.php @@ -123,11 +123,11 @@ YAML; { foreach ($this->files as $file) { if (file_exists($file)) { - unlink($file); + @unlink($file); } } - rmdir(sys_get_temp_dir().'/framework-yml-lint-test'); + @rmdir(sys_get_temp_dir().'/framework-yml-lint-test'); } }