Skip to content

Commit 39f03dd

Browse files
committed
Update test
1 parent 8b75332 commit 39f03dd

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/Unit/Listeners/FixSymfonyFileMovingListenerTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,28 @@ class FixSymfonyFileMovingListenerTest extends AbstractListenerTestCase
1717
*/
1818
public function testHandle(): void
1919
{
20+
$tmp_dir = $this->createTemporaryDirectory();
21+
2022
$function_location = '\\Symfony\\Component\\HttpFoundation\\File\\move_uploaded_file';
23+
$old_file_path = $tmp_dir . DIRECTORY_SEPARATOR . Str::random();
24+
$new_file_path = $tmp_dir . DIRECTORY_SEPARATOR . Str::random();
25+
\file_put_contents($old_file_path, '');
2126

2227
$this->assertFalse(\function_exists($function_location));
23-
$this->assertFalse(\is_uploaded_file('foo'));
28+
$this->assertFalse(\move_uploaded_file($old_file_path, $new_file_path));
2429

2530
$this->listenerFactory()->handle(new \stdClass());
2631

2732
$this->assertTrue(\function_exists($function_location));
28-
29-
$tmp_dir = $this->createTemporaryDirectory();
30-
$old_file_path = $tmp_dir . DIRECTORY_SEPARATOR . Str::random();
31-
$new_file_path = $tmp_dir . DIRECTORY_SEPARATOR . Str::random();
32-
\file_put_contents($old_file_path, '');
3333
$this->assertFileExists($old_file_path);
3434
$this->assertTrue($function_location($old_file_path, $new_file_path));
3535
$this->assertFileExists($new_file_path);
3636
$this->assertFileNotExists($old_file_path);
3737
$rnd_file_path1 = $tmp_dir . DIRECTORY_SEPARATOR . Str::random();
3838
$rnd_file_path2 = $tmp_dir . DIRECTORY_SEPARATOR . Str::random();
3939
$this->assertFalse($function_location($rnd_file_path1, $rnd_file_path2));
40+
$this->assertFileNotExists($rnd_file_path1);
41+
$this->assertFileNotExists($rnd_file_path2);
4042
}
4143

4244
/**

0 commit comments

Comments
 (0)