41 private $payloadValidator;
46 private $updaterTaskCreator;
50 $this->payloadValidator = $this->createMock(\
Magento\Setup\Model\PayloadValidator::class);
51 $this->updaterTaskCreator = $this->createMock(\
Magento\Setup\Model\UpdaterTaskCreator::class);
54 $this->updaterTaskCreator,
55 $this->payloadValidator
57 $this->request = $this->createMock(\
Zend\Http\PhpEnvironment\Request::class);
58 $this->response = $this->createMock(\
Zend\Http\PhpEnvironment\Response::class);
59 $routeMatch = $this->createMock(\
Zend\Mvc\Router\RouteMatch::class);
60 $this->mvcEvent = $this->createMock(\
Zend\Mvc\MvcEvent::class);
61 $this->mvcEvent->expects($this->any())
62 ->method(
'setRequest')
63 ->with($this->request)
64 ->willReturn($this->mvcEvent);
65 $this->mvcEvent->expects($this->any())
66 ->method(
'setResponse')
67 ->with($this->response)
68 ->willReturn($this->mvcEvent);
69 $this->mvcEvent->expects($this->any())
71 ->with($this->controller)
72 ->willReturn($this->mvcEvent);
73 $this->mvcEvent->expects($this->any())->method(
'getRouteMatch')->willReturn($routeMatch);
79 $this->assertInstanceOf(\
Zend\View\Model\ViewModel::class,
$viewModel);
90 $this->request->expects($this->any())->method(
'getContent')->willReturn(
$content);
91 $this->payloadValidator->expects($this->exactly($payload))->method(
'validatePayload');
92 $this->controller->setEvent($this->mvcEvent);
93 $this->controller->dispatch($this->request, $this->response);
94 $this->controller->updateAction();
103 'NoParmas' => [
'{}', 0],
104 'NoArray' => [
'{"packages":"test","type":"update"}', 0],
105 'NoVersion' => [
'{"packages":[{"name":"vendor\/package"}],"type":"update"}', 1],
106 'NoDataOption' => [
'{"packages":[{"name":"vendor\/package", "version": "1.0.0"}],"type":"uninstall"}', 1],
107 'NoPackageInfo' => [
'{"packages":"test","type":"update"}', 0]
113 $content =
'{"packages":[{"name":"vendor\/package","version":"1.0"}],"type":"update",' 114 .
'"headerTitle": "Update package 1" }';
115 $this->request->expects($this->any())->method(
'getContent')->willReturn(
$content);
116 $this->payloadValidator->expects($this->once())->method(
'validatePayload')->willReturn(
'');
117 $this->updaterTaskCreator->expects($this->once())->method(
'createUpdaterTasks')->willReturn(
'');
118 $this->controller->setEvent($this->mvcEvent);
119 $this->controller->dispatch($this->request, $this->response);
120 $this->controller->updateAction();
testUpdateActionSuccess()
testUpdateInvalidRequest($content, $payload)
updateInvalidRequestDataProvider()