Skip to content
Snippets Groups Projects

Issue #3328234: Improve test DX *and* confidence: assert VFS state

Compare and Show latest version
1 file
+ 13
2
Compare changes
  • Side-by-side
  • Inline
@@ -255,11 +255,22 @@ abstract class PackageManagerKernelTestBase extends KernelTestBase {
// Create the active directory and copy its contents from a fixture.
$active_dir = $root . DIRECTORY_SEPARATOR . 'active';
$this->assertTrue(mkdir($active_dir));
if ($this->useVfs) {
// Move vfs://root/sites to vfs://root/active/sites.
$sites_in_vfs = vfsStream::url('root/sites');
rename($sites_in_vfs, $sites_in_vfs . '/active');
}
static::copyFixtureFilesTo($source_dir, $active_dir);
// Override siteDirectory to point to root/active/... instead of root/... .
$test_site_path = str_replace('vfs://root/', '', $this->siteDirectory);
$this->siteDirectory = vfsStream::url('root/active/' . $test_site_path);
if ($this->useVfs) {
$test_site_path = str_replace('vfs://root/', '', $this->siteDirectory);
$this->siteDirectory = vfsStream::url('root/active/' . $test_site_path);
}
else {
$test_site_path = str_replace('vfs://root/', '', $this->siteDirectory);
$this->siteDirectory = $active_dir . $test_site_path;
}
// Override KernelTestBase::setUpFilesystem's Settings object.
$settings = Settings::getInstance() ? Settings::getAll() : [];
$settings['file_public_path'] = $this->siteDirectory . '/files';
Loading