15 private $composerJsonFinder;
20 private $directoryList;
25 private $reqUpdDryRunCommand;
35 private $dependencyReadinessCheck;
39 $this->composerJsonFinder =
40 $this->createMock(\
Magento\Framework\Composer\ComposerJsonFinder::class);
41 $this->composerJsonFinder->expects($this->once())->method(
'findComposerJson')->willReturn(
'composer.json');
42 $this->directoryList =
44 $this->directoryList->expects($this->exactly(2))->method(
'getPath')->willReturn(
'var');
45 $this->reqUpdDryRunCommand =
46 $this->createMock(\
Magento\Composer\RequireUpdateDryRunCommand::class);
47 $this->file = $this->createMock(\
Magento\Framework\
Filesystem\Driver\File::class);
48 $this->file->expects($this->once())->method(
'copy')->with(
'composer.json',
'var/composer.json');
49 $composerAppFactory = $this->createMock(\
Magento\Framework\Composer\MagentoComposerApplicationFactory::class);
50 $composerAppFactory->expects($this->once())
51 ->method(
'createRequireUpdateDryRunCommand')
52 ->willReturn($this->reqUpdDryRunCommand);
54 $this->composerJsonFinder,
63 $this->reqUpdDryRunCommand->expects($this->once())
66 ->willThrowException(
new \
RuntimeException(
'Failed' . PHP_EOL .
'dependency readiness check'));
67 $expected = [
'success' =>
false,
'error' =>
'Failed<br/>dependency readiness check'];
68 $this->assertEquals($expected, $this->dependencyReadinessCheck->runReadinessCheck([]));
73 $this->reqUpdDryRunCommand->expects($this->once())
76 ->willReturn(
'Success');
77 $expected = [
'success' =>
true];
78 $this->assertEquals($expected, $this->dependencyReadinessCheck->runReadinessCheck([]));
testRunReadinessCheckFailed()