Skip to content
Snippets Groups Projects
Commit b485deb6 authored by Kunal Sachdev's avatar Kunal Sachdev Committed by Ted Bowman
Browse files

Issue #3331471 by kunal.sachdev: Add documentation for SymlinkValidatorTest

parent f2bf8c73
No related branches found
No related tags found
1 merge request!660Issue #3331471: Add documentation for SymlinkValidatorTest
...@@ -93,16 +93,23 @@ class SymlinkValidatorTest extends PackageManagerKernelTestBase { ...@@ -93,16 +93,23 @@ class SymlinkValidatorTest extends PackageManagerKernelTestBase {
}; };
$this->addEventTestListener($add_ignored_path, CollectIgnoredPathsEvent::class); $this->addEventTestListener($add_ignored_path, CollectIgnoredPathsEvent::class);
// Expected argument types for active directory, stage directory and ignored
// paths passed while checking if precondition is fulfilled.
// @see \PhpTuf\ComposerStager\Domain\Service\Precondition\PreconditionInterface::assertIsFulfilled()
$arguments = [ $arguments = [
Argument::type(PathInterface::class), Argument::type(PathInterface::class),
Argument::type(PathInterface::class), Argument::type(PathInterface::class),
Argument::type(PathListInterface::class), Argument::type(PathListInterface::class),
]; ];
$listener = function () use ($arguments, $symlinks_exist): void { $listener = function () use ($arguments, $symlinks_exist): void {
// Ensure that the Composer Stager's symlink precondition is invoked.
$this->precondition->assertIsFulfilled(...$arguments) $this->precondition->assertIsFulfilled(...$arguments)
->will(function (array $arguments) use ($symlinks_exist): void { ->will(function (array $arguments) use ($symlinks_exist): void {
// Ensure that 'ignore/me' is present in ignored paths.
Assert::assertContains('ignore/me', $arguments[2]->getAll()); Assert::assertContains('ignore/me', $arguments[2]->getAll());
// Whether to simulate or not that a symlink is found in the active
// or staging directory (but outside the ignored paths).
if ($symlinks_exist) { if ($symlinks_exist) {
throw new PreconditionException($this->reveal(), 'Symlinks were found.'); throw new PreconditionException($this->reveal(), 'Symlinks were found.');
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment