Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
MagentoComposerApplicationTest Class Reference
Inheritance diagram for MagentoComposerApplicationTest:

Public Member Functions

 testWrongExitCode ()
 
 testRunCommand ()
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $application
 
 $composerApplication
 
 $inputFactory
 
 $consoleOutput
 

Detailed Description

Definition at line 12 of file MagentoComposerApplicationTest.php.

Member Function Documentation

◆ setUp()

setUp ( )
protected

Definition at line 34 of file MagentoComposerApplicationTest.php.

35  {
36  $this->composerApplication = $this->createMock(\Composer\Console\Application::class);
37  $this->inputFactory = $this->createMock(\Magento\Composer\ConsoleArrayInputFactory::class);
38  $this->consoleOutput = $this->createMock(\Symfony\Component\Console\Output\BufferedOutput::class);
39 
40  $this->application = new MagentoComposerApplication(
41  'path1',
42  'path2',
43  $this->composerApplication,
44  $this->inputFactory,
45  $this->consoleOutput
46  );
47  }

◆ testRunCommand()

testRunCommand ( )

Definition at line 60 of file MagentoComposerApplicationTest.php.

61  {
62  $inputData = ['command' => 'update', MagentoComposerApplication::COMPOSER_WORKING_DIR => '.'];
63 
64  $this->composerApplication->expects($this->once())->method('resetComposer');
65 
66  $this->inputFactory->expects($this->once())->method('create')->with($inputData);
67 
68  $this->consoleOutput->expects($this->once())->method('fetch')->willReturn('Nothing to update');
69 
70  $this->composerApplication->expects($this->once())->method('run')->willReturn(0);
71 
72  $message = $this->application->runComposerCommand($inputData);
73  $this->assertEquals('Nothing to update', $message);
74  }
$message

◆ testWrongExitCode()

testWrongExitCode ( )

@expectedException \RuntimeException @expectedExceptionMessage Command "update" failed

Definition at line 53 of file MagentoComposerApplicationTest.php.

54  {
55  $this->composerApplication->expects($this->once())->method('run')->willReturn(1);
56 
57  $this->application->runComposerCommand(['command'=>'update']);
58  }

Field Documentation

◆ $application

$application
protected

Definition at line 17 of file MagentoComposerApplicationTest.php.

◆ $composerApplication

$composerApplication
protected

Definition at line 22 of file MagentoComposerApplicationTest.php.

◆ $consoleOutput

$consoleOutput
protected

Definition at line 32 of file MagentoComposerApplicationTest.php.

◆ $inputFactory

$inputFactory
protected

Definition at line 27 of file MagentoComposerApplicationTest.php.


The documentation for this class was generated from the following file: