function LoggingStagerTest::testDecoratedStagerIsCalled

File

core/modules/package_manager/tests/src/Unit/LoggingStagerTest.php, line 21

Class

LoggingStagerTest
@covers \Drupal\package_manager\LoggingStager @group package_manager

Namespace

Drupal\Tests\package_manager\Unit

Code

public function testDecoratedStagerIsCalled() : void {
    $decorated = $this->createMock(StagerInterface::class);
    $activeDir = $this->createMock(PathInterface::class);
    $stagingDir = $this->createMock(PathInterface::class);
    $stagingDir->expects($this->any())
        ->method('absolute')
        ->willReturn('staging-dir');
    $original_callback = $this->createMock(OutputCallbackInterface::class);
    $original_callback->expects($this->once())
        ->method('__invoke')
        ->with(OutputTypeEnum::OUT, "### Staging '--version' in staging-dir\n");
    $decorated->expects($this->once())
        ->method('stage')
        ->with([
        '--version',
    ], $activeDir, $stagingDir, $this->isInstanceOf(FileProcessOutputCallback::class));
    $config_factory = $this->getConfigFactoryStub([
        'package_manager.settings' => [
            'log' => 'php://memory',
        ],
    ]);
    $decorator = new LoggingStager($decorated, $config_factory);
    $decorator->stage([
        '--version',
    ], $activeDir, $stagingDir, callback: $original_callback);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.