8000 minor #38560 [CI] Silence errors when remove file/dir on test tearDow… · symfony/symfony@9b2dcac · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b2dcac

Browse files
committed
minor #38560 [CI] Silence errors when remove file/dir on test tearDown() (Nyholm)
This PR was merged into the 3.4 branch. Discussion ---------- [CI] Silence errors when remove file/dir on test tearDown() | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | | Deprecations? | | Tickets | | License | MIT | Doc PR | Requested in #38556 Commits ------- efef41f [CI] Silence errors when remove file/dir on test tearDown()
2 parents 84887f2 + efef41f commit 9b2dcac

File tree

13 files changed

+18
-22
lines changed

13 files changed

+18
-22
lines changed

src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ protected function tearDown()
120120
{
121121
foreach ($this->files as $file) {
122122
if (file_exists($file)) {
123-
unlink($file);
123+
@unlink($file);
124124
}
125125
}
126126
}

src/Symfony/Bundle/FrameworkBundle/Tests/Command/YamlLintCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ protected function tearDown()
174174
{
175175
foreach ($this->files as $file) {
176176
if (file_exists($file)) {
177-
unlink($file);
177+
@unlink($file);
178178
}
179179
}
180-
rmdir(sys_get_temp_dir().'/yml-lint-test');
180+
@rmdir(sys_get_temp_dir().'/yml-lint-test');
181181
}
182182
}

src/Symfony/Component/Config/Tests/ConfigCacheTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function tearDown()
3030

3131
foreach ($files as $file) {
3232
if (file_exists($file)) {
33-
unlink($file);
33+
@unlink($file);
3434
}
3535
}
3636
}

src/Symfony/Component/Config/Tests/Resource/FileExistenceResourceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function setUp()
3030
protected function tearDown()
3131
{
3232
if (file_exists($this->file)) {
33-
unlink($this->file);
33+
@unlink($this->file);
3434
}
3535
}
3636

src/Symfony/Component/Config/Tests/Resource/FileResourceTest.php

Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ protected function setUp()
3030

3131
protected function tearDown()
3232
{
33-
if (!file_exists($this->file)) {
34-
return;
33+
if (file_exists($this->file)) {
34+
@unlink($this->file);
3535
}
36-
37-
unlink($this->file);
3836
}
3937

4038
public function testGetResource()
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected function tearDown()
3131

3232
foreach ($files as $file) {
3333
if (file_exists($file)) {
34-
unlink($file);
34+
@unlink($file);
3535
}
3636
}
3737
}
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,9 @@ public function testNotFreshIfClassNotFound()
103103

104104
protected function tearDown()
105105
{
106-
if (!file_exists($this->file)) {
107-
return;
106+
if (file_exists($this->file)) {
107+
@unlink($this->file);
108108
}
109-
110-
unlink($this->file);
111109
}
112110

113111
private function getStaleFileTime()
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ protected function setUp()
165165
protected function tearDown()
166166
{
167167
foreach (glob(sys_get_temp_dir().'/form_test/*') as $file) {
168-
unlink($file);
168+
@unlink($file);
169169
}
170170

171-
rmdir(sys_get_temp_dir().'/form_test');
171+
@rmdir(sys_get_temp_dir().'/form_test');
172172
}
173173
}
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function tearDown()
4343
{
4444
array_map('unlink', glob($this->sessionDir.'/*'));
4545
if (is_dir($this->sessionDir)) {
46-
rmdir($this->sessionDir);
46+
@rmdir($this->sessionDir);
4747
}
4848
$this->sessionDir = null;
4949
$this->storage = null;
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function tearDown()
4747
session_write_close();
4848
array_map('unlink', glob($this->savePath.'/*'));
4949
if (is_dir($this->savePath)) {
50-
rmdir($this->savePath);
50+
@rmdir($this->savePath);
5151
}
5252

5353
$this->savePath = null;
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function tearDown()
4343
session_write_close();
4444
array_map('unlink', glob($this->savePath.'/*'));
4545
if (is_dir($this->savePath)) {
46-
rmdir($this->savePath);
46+
@rmdir($this->savePath);
4747
}
4848

4949
$this->savePath = null;
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function tearDown()
4545
}
4646

4747
if (file_exists($this->path)) {
48-
unlink($this->path);
48+
@unlink($this->path);
4949
}
5050

5151
$this->path = null;
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ protected function tearDown()
123123
{
124124
foreach ($this->files as $file) {
125125
if (file_exists($file)) {
126-
unlink($file);
126+
@unlink($file);
127127
}
128128
}
129129

130-
rmdir(sys_get_temp_dir().'/framework-yml-lint-test');
130+
@rmdir(sys_get_temp_dir().'/framework-yml-lint-test');
131131
}
132132
}
133133