Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #35 from flagbit/bugfix/ASPHALT-615
Browse files Browse the repository at this point in the history
[ASPHALT-615] fix upload for Mage 2.3.5
  • Loading branch information
plel authored Sep 28, 2020
2 parents ddf4404 + d982345 commit a3842c9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Block/Adminhtml/Filesystem/Content/Uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function _construct()
$type = $this->_getMediaType();

$this->getConfig()->setUrl(
$this->_urlBuilder->addSessionParam()->getUrl('flagbit_flysystem/*/upload', ['type' => $type])
$this->_urlBuilder->getUrl('flagbit_flysystem/*/upload', ['type' => $type])
)->setFileField(
\Flagbit\Flysystem\Helper\Config::FLYSYSTEM_UPLOAD_ID
);
Expand Down
34 changes: 4 additions & 30 deletions Test/Unit/Block/Adminhtml/Filesystem/Content/UploaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ protected function setUp(): void

$this->_urlBuilderMock = $this->getMockBuilder(Url::class)
->disableOriginalConstructor()
->setMethods(['getUrl', 'addSessionParam'])
->setMethods(['getUrl'])
->getMock();

$this->_mathRandomMock = $this->getMockBuilder(Random::class)
Expand Down Expand Up @@ -122,15 +122,6 @@ public function testContructor(): void
->withAnyParameters()
->willReturn($uniqueHash);

$this->_urlBuilderMock->expects($this->at(0))
->method('addSessionParam')
->willReturn($this->_urlBuilderMock);

$this->_urlBuilderMock->expects($this->at(1))
->method('getUrl')
->with('adminhtml/*/upload')
->willReturn('asdf');

$this->_formKeyMock->expects($this->once())
->method('getFormKey')
->willReturn($formKey);
Expand All @@ -140,11 +131,7 @@ public function testContructor(): void
->with('type')
->willReturn($mediaType);

$this->_urlBuilderMock->expects($this->at(2))
->method('addSessionParam')
->willReturn($this->_urlBuilderMock);

$this->_urlBuilderMock->expects($this->at(3))
$this->_urlBuilderMock->expects($this->at(1))
->method('getUrl')
->with($uri, $this->arrayHasKey('type'))
->willReturn($url);
Expand All @@ -168,24 +155,11 @@ public function testContructorWithMediaType(): void
->withAnyParameters()
->willReturn($uniqueHash);

$this->_urlBuilderMock->expects($this->at(0))
->method('addSessionParam')
->willReturn($this->_urlBuilderMock);

$this->_urlBuilderMock->expects($this->at(1))
->method('getUrl')
->with('adminhtml/*/upload')
->willReturn('asdf');

$this->_formKeyMock->expects($this->once())
->method('getFormKey')
->willReturn($formKey);

$this->_urlBuilderMock->expects($this->at(2))
->method('addSessionParam')
->willReturn($this->_urlBuilderMock);

$this->_urlBuilderMock->expects($this->at(3))
$this->_urlBuilderMock->expects($this->at(1))
->method('getUrl')
->with($uri, $this->arrayHasKey('type'))
->willReturn($url);
Expand All @@ -196,4 +170,4 @@ public function testContructorWithMediaType(): void
['media_type' => $mediaType]
);
}
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"php": ">=7.1.0",
"league/flysystem": "^1.0",
"league/flysystem-sftp": "^1.0",
"magento/framework": ">=101.0.0",
"magento/framework": ">=102.0.5",
"magento/module-backend": ">=100.2.0",
"magento/magento-composer-installer": "*"
},
Expand Down

0 comments on commit a3842c9

Please sign in to comment.