function EnvironmentCleanerTest::testDoCleanTemporaryDirectories
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Test/EnvironmentCleanerTest.php \Drupal\KernelTests\Core\Test\EnvironmentCleanerTest::testDoCleanTemporaryDirectories()
- 10 core/tests/Drupal/KernelTests/Core/Test/EnvironmentCleanerTest.php \Drupal\KernelTests\Core\Test\EnvironmentCleanerTest::testDoCleanTemporaryDirectories()
- 11.x core/tests/Drupal/KernelTests/Core/Test/EnvironmentCleanerTest.php \Drupal\KernelTests\Core\Test\EnvironmentCleanerTest::testDoCleanTemporaryDirectories()
@covers ::doCleanTemporaryDirectories
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Test/ EnvironmentCleanerTest.php, line 20
Class
- EnvironmentCleanerTest
- @coversDefaultClass \Drupal\Core\Test\EnvironmentCleaner @group Test
Namespace
Drupal\KernelTests\Core\TestCode
public function testDoCleanTemporaryDirectories() {
vfsStream::setup('cleanup_test', NULL, [
'sites' => [
'simpletest' => [
'delete_dir' => [
'delete.me' => 'I am a gonner.',
],
'delete_me.too' => 'delete this file.',
],
],
]);
$connection = $this->prophesize(Connection::class);
$cleaner = new EnvironmentCleaner(vfsStream::url('cleanup_test'), $connection->reveal(), $connection->reveal(), new NullOutput(), \Drupal::service('file_system'));
$do_cleanup_ref = new \ReflectionMethod($cleaner, 'doCleanTemporaryDirectories');
$do_cleanup_ref->setAccessible(TRUE);
$this->assertFileExists(vfsStream::url('cleanup_test/sites/simpletest/delete_dir/delete.me'));
$this->assertFileExists(vfsStream::url('cleanup_test/sites/simpletest/delete_me.too'));
$this->assertEquals(2, $do_cleanup_ref->invoke($cleaner));
$this->assertDirectoryNotExists(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'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.