b374k
m1n1 1.01
Apache/2.4.41 (Ubuntu)
Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64
uid=33(www-data) gid=33(www-data) groups=33(www-data)
server ip : 62.171.164.128 | your ip : 127.0.0.1
safemode OFF
 >  / home / dev2.destoffenstraat.com / update / app / code / Magento / Update / Test / Unit / Queue /
Filename/home/dev2.destoffenstraat.com/update/app/code/Magento/Update/Test/Unit/Queue/JobUpdateTest.php
Size3.37 kb
Permissionrw-r--r--
Ownerroot : root
Create time17-Aug-2025 10:26
Last modified06-Apr-2021 18:06
Last accessed24-Aug-2025 04:59
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Update\Queue;

class JobUpdateTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Update\Status
*/
private $status;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Composer\MagentoComposerApplication
*/
private $composerApp;

/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Update\Queue
*/
private $queue;

public function setUp()
{

$this->status = $this->getMock('Magento\Update\Status', [], [], '', false);
$this->composerApp = $this->getMock('Magento\Composer\MagentoComposerApplication', [], [], '', false);
$this->queue = $this->getMock('Magento\Update\Queue', [], [], '', false);

}

public function testExecute()
{
$jobUpdate = new \Magento\Update\Queue\JobUpdate(
'setup:upgrade',
['components' => [['name' => 'vendor/package', 'version' => '1.0']]],
$this->queue,
$this->composerApp,
$this->status
);

$this->status->expects($this->atLeastOnce())->method('add');
$this->composerApp->expects($this->at(0))
->method('runComposerCommand')
->with(['command' => 'require', 'packages' => ['vendor/package 1.0'], '--no-update' => true])
->willReturn('Success');
$this->composerApp->expects($this->at(1))
->method('runComposerCommand')
->with(['command' => 'update'])
->willReturn('Success');
$this->queue->expects($this->once())->method('addJobs')->with([['name' => 'setup:upgrade', 'params' => []]]);
$jobUpdate->execute();
}

/**
* @expectedException \RuntimeException
* @expectedExceptionMessage Cannot find component to update
*/
public function testExecuteNoRequire()
{
$jobUpdate = new \Magento\Update\Queue\JobUpdate(
'setup:upgrade',
[],
$this->queue,
$this->composerApp,
$this->status
);
$this->composerApp->expects($this->never())->method('runComposerCommand');
$this->queue->expects($this->never())->method('addJobs');
$jobUpdate->execute();
}

/**
* @expectedException \RuntimeException
* @expectedExceptionMessage Exception
*/
public function testExecuteException()
{
$jobUpdate = new \Magento\Update\Queue\JobUpdate(
'setup:upgrade',
['components' => [['name' => 'vendor/package', 'version' => '1.0']]],
$this->queue,
$this->composerApp,
$this->status
);
$this->status->expects($this->atLeastOnce())->method('add');
$this->composerApp->expects($this->at(0))
->method('runComposerCommand')
->with(['command' => 'require', 'packages' => ['vendor/package 1.0'], '--no-update' => true])
->willReturn('Success');
$this->composerApp->expects($this->at(1))
->method('runComposerCommand')
->with(['command' => 'update'])
->will($this->throwException(new \Exception('Exception')));
$this->status->expects($this->once())->method('setUpdateError')->with(true);
$jobUpdate->execute();
}
}