Improve test DX *and* confidence: stop using VFS

Created on 20 December 2022, almost 2 years ago
Updated 31 March 2023, over 1 year ago

Problem/Motivation

This was surfaced by @omkar.podey in πŸ› GitExcluder should not ignore .git directories that belong to packages installed by Composer Fixed , where the test infrastructure does not seem to behave as expected. And since VFS lives in memory, it's very painful to debug step-by-step. A helper method would go a long way.

\Drupal\KernelTests\KernelTestBase::vfsDump() is really helpful but does not allow assertions.

The only example in all of Drupal core is in \Drupal\KernelTests\KernelTestBaseTest::testBootEnvironment(). But it does not provide test infrastructure.

Steps to reproduce

Proposed resolution

Add test infrastructure: \Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase::assertVfsDump(), which allows you to do:

$this->assertVfsDump('');

to get a baseline. This will then allow you to copy/paste that into something like this (where this is the more complicated part because the site directory name is dynamic):

    $site_dir_name = basename($this->siteDirectory);
    $this->assertVfsDump(<<<"VFS"
- root
  - sites
    - simpletest
      - $site_dir_name
        - files
          - config
            - sync

VFS);

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Assigned to wim leers
  • Status changed to Needs review almost 2 years ago
  • Assigned to tedbow
  • Status changed to RTBC almost 2 years ago
  • Status changed to Fixed almost 2 years ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

    This issue could still use an issue summary update. Even though this issue is closed it may be still useful for the summary to at least be an accurate summary of what the fix actually was.

    I was going to link this issue from ✨ Add Alpha level Experimental Package Manager module Needs review but the realized the summary was not what we actually did so it would just be confusing

Production build 0.71.5 2024