Skip to content

Commit 112a630

Browse files
committed
AC-11610: Catalog Search fix
* Static tests fix
1 parent 5053bc2 commit 112a630

File tree

1 file changed

+15
-5
lines changed
  • app/code/Magento/AdvancedSearch/Controller/Adminhtml/Search/System/Config

1 file changed

+15
-5
lines changed

app/code/Magento/AdvancedSearch/Controller/Adminhtml/Search/System/Config/TestConnection.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,21 @@
99
use Magento\Backend\App\Action;
1010
use Magento\Backend\App\Action\Context;
1111
use Magento\AdvancedSearch\Model\Client\ClientResolver;
12+
use Magento\Framework\App\Action\HttpPostActionInterface;
13+
use Magento\Framework\Controller\Result\Json;
1214
use Magento\Framework\Controller\Result\JsonFactory;
15+
use Magento\Framework\Exception\LocalizedException;
1316
use Magento\Framework\Filter\StripTags;
1417

15-
class TestConnection extends Action
18+
class TestConnection extends Action implements HttpPostActionInterface
1619
{
20+
/**
21+
* Authorization level of a basic admin session.
22+
*
23+
* @see _isAllowed()
24+
*/
25+
const ADMIN_RESOURCE = 'Magento_Catalog::config_catalog';
26+
1727
/**
1828
* @var ClientResolver
1929
*/
@@ -50,7 +60,7 @@ public function __construct(
5060
/**
5161
* Check for connection to server
5262
*
53-
* @return \Magento\Framework\Controller\Result\Json
63+
* @return Json
5464
*/
5565
public function execute()
5666
{
@@ -62,22 +72,22 @@ public function execute()
6272

6373
try {
6474
if (empty($options['engine'])) {
65-
throw new \Magento\Framework\Exception\LocalizedException(
75+
throw new LocalizedException(
6676
__('Missing search engine parameter.')
6777
);
6878
}
6979
$response = $this->clientResolver->create($options['engine'], $options)->testConnection();
7080
if ($response) {
7181
$result['success'] = true;
7282
}
73-
} catch (\Magento\Framework\Exception\LocalizedException $e) {
83+
} catch (LocalizedException $e) {
7484
$result['errorMessage'] = $e->getMessage();
7585
} catch (\Exception $e) {
7686
$message = __($e->getMessage());
7787
$result['errorMessage'] = $this->tagFilter->filter($message);
7888
}
7989

80-
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
90+
/** @var Json $resultJson */
8191
$resultJson = $this->resultJsonFactory->create();
8292
return $resultJson->setData($result);
8393
}

0 commit comments

Comments
 (0)