Problem/Motivation
because PackageManagerKernelTestBase::assertResults()
// If we did not get an exception, ensure we didn't expect any results.
$this->assertEmpty($expected_results);
If a test fails because the results are not empty you will just see
Failed asserting that an array is not empty.
which is not very helpful
Steps to reproduce
To force a failed test like what might happen in debugging an issue
- add return statement to the top of
\Drupal\package_manager\Validator\LockFileValidator::validateStagePreOperationso we never add an error - Run
\Drupal\Tests\package_manager\Kernel\LockFileValidatorTest::testLockFileChangedwhich expects an error - get the error "Failed asserting that an array is not empty."
Proposed resolution
replace
$this->assertEmpty($expected_results);
with
$this->assertValidationResultsEqual([], $expected_results);
which will show the error we were expecting
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork automatic_updates-3337062
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
tedbowComment #4
tedbowComment #5
tedbowComment #6
phenaproximaComment #8
tedbowThanks @phenaproxima!