/** * Setup DirectoryList, Filesystem, and ComposerJsonFinder to use a specified directory for reading composer files * * @param $composerDir string Directory under _files that contains composer files */ private function setupDirectory($composerDir) { $absoluteComposerDir = realpath(__DIR__ . '/_files/' . $composerDir . '/composer.json'); $this->composerJsonFinder = $this->getMockBuilder('Magento\\Framework\\Composer\\ComposerJsonFinder')->disableOriginalConstructor()->setMethods([])->getMock(); $this->composerJsonFinder->expects($this->any())->method('findComposerJson')->willReturn($absoluteComposerDir); $this->directoryList = $this->objectManager->get('Magento\\Framework\\App\\Filesystem\\DirectoryList'); $this->filesystem = $this->objectManager->get('Magento\\Framework\\Filesystem'); /** @var \Magento\Framework\Composer\ComposerInformation $composerInfo */ $this->composerInformation = $this->objectManager->create('Magento\\Framework\\Composer\\ComposerInformation', ['applicationFactory' => new MagentoComposerApplicationFactory($this->composerJsonFinder, $this->directoryList)]); }
public function setUp() { $this->composerJsonFinder = $this->getMock('Magento\\Framework\\Composer\\ComposerJsonFinder', [], [], '', false); $this->composerJsonFinder->expects($this->once())->method('findComposerJson')->willReturn('composer.json'); $this->directoryList = $this->getMock('Magento\\Framework\\App\\Filesystem\\DirectoryList', [], [], '', false); $this->directoryList->expects($this->exactly(2))->method('getPath')->willReturn('var'); $this->reqUpdDryRunCommand = $this->getMock('Magento\\Composer\\RequireUpdateDryRunCommand', [], [], '', false); $this->file = $this->getMock('Magento\\Framework\\Filesystem\\Driver\\File', [], [], '', false); $this->file->expects($this->once())->method('copy')->with('composer.json', 'var/composer.json'); $composerAppFactory = $this->getMock('Magento\\Framework\\Composer\\MagentoComposerApplicationFactory', [], [], '', false); $composerAppFactory->expects($this->once())->method('createRequireUpdateDryRunCommand')->willReturn($this->reqUpdDryRunCommand); $this->dependencyReadinessCheck = new DependencyReadinessCheck($this->composerJsonFinder, $this->directoryList, $this->file, $composerAppFactory); }