mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-23 07:56:12 +01:00
TASK: Use new SearchRequestInterface everywhere
Otherwise the interface is no big benefit. Also it might crash under some circumstances.
This commit is contained in:
parent
89a558e735
commit
831da6a4e4
3 changed files with 9 additions and 10 deletions
|
@ -21,7 +21,7 @@ namespace Codappix\SearchCore\Connection;
|
||||||
* 02110-1301, USA.
|
* 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Codappix\SearchCore\Domain\Search\SearchService;
|
use Codappix\SearchCore\Domain\Search\SearchServiceInterface;
|
||||||
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
|
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
|
||||||
|
|
||||||
interface SearchRequestInterface extends QueryInterface
|
interface SearchRequestInterface extends QueryInterface
|
||||||
|
@ -54,5 +54,5 @@ interface SearchRequestInterface extends QueryInterface
|
||||||
* Workaround for paginate widget support which will
|
* Workaround for paginate widget support which will
|
||||||
* use the request to build another search.
|
* use the request to build another search.
|
||||||
*/
|
*/
|
||||||
public function setSearchService(SearchService $searchService);
|
public function setSearchService(SearchServiceInterface $searchService);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ use Codappix\SearchCore\Connection\ConnectionInterface;
|
||||||
use Codappix\SearchCore\Connection\FacetRequestInterface;
|
use Codappix\SearchCore\Connection\FacetRequestInterface;
|
||||||
use Codappix\SearchCore\Connection\SearchRequestInterface;
|
use Codappix\SearchCore\Connection\SearchRequestInterface;
|
||||||
use Codappix\SearchCore\Connection\SearchResultInterface;
|
use Codappix\SearchCore\Connection\SearchResultInterface;
|
||||||
use Codappix\SearchCore\Domain\Search\SearchService;
|
use Codappix\SearchCore\Domain\Search\SearchServiceInterface;
|
||||||
use Codappix\SearchCore\Utility\ArrayUtility as CustomArrayUtility;
|
use Codappix\SearchCore\Utility\ArrayUtility as CustomArrayUtility;
|
||||||
use TYPO3\CMS\Core\Utility\ArrayUtility;
|
use TYPO3\CMS\Core\Utility\ArrayUtility;
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class SearchRequest implements SearchRequestInterface
|
||||||
protected $connection;
|
protected $connection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SearchService
|
* @var SearchServiceInterface
|
||||||
*/
|
*/
|
||||||
protected $searchService;
|
protected $searchService;
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ class SearchRequest implements SearchRequestInterface
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSearchService(SearchService $searchService)
|
public function setSearchService(SearchServiceInterface $searchService)
|
||||||
{
|
{
|
||||||
$this->searchService = $searchService;
|
$this->searchService = $searchService;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ class SearchRequest implements SearchRequestInterface
|
||||||
1502197732
|
1502197732
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!($this->searchService instanceof SearchService)) {
|
if (!($this->searchService instanceof SearchServiceInterface)) {
|
||||||
throw new \InvalidArgumentException(
|
throw new \InvalidArgumentException(
|
||||||
'SearchService was not set before, therefore execute can not work. Use `setSearchService` before.',
|
'SearchService was not set before, therefore execute can not work. Use `setSearchService` before.',
|
||||||
1520325175
|
1520325175
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace Codappix\SearchCore\Tests\Unit\Domain\Model;
|
||||||
use Codappix\SearchCore\Connection\ConnectionInterface;
|
use Codappix\SearchCore\Connection\ConnectionInterface;
|
||||||
use Codappix\SearchCore\Connection\SearchResultInterface;
|
use Codappix\SearchCore\Connection\SearchResultInterface;
|
||||||
use Codappix\SearchCore\Domain\Model\SearchRequest;
|
use Codappix\SearchCore\Domain\Model\SearchRequest;
|
||||||
use Codappix\SearchCore\Domain\Search\SearchService;
|
use Codappix\SearchCore\Domain\Search\SearchServiceInterface;
|
||||||
use Codappix\SearchCore\Tests\Unit\AbstractUnitTestCase;
|
use Codappix\SearchCore\Tests\Unit\AbstractUnitTestCase;
|
||||||
|
|
||||||
class SearchRequestTest extends AbstractUnitTestCase
|
class SearchRequestTest extends AbstractUnitTestCase
|
||||||
|
@ -105,7 +105,7 @@ class SearchRequestTest extends AbstractUnitTestCase
|
||||||
{
|
{
|
||||||
$subject = new SearchRequest();
|
$subject = new SearchRequest();
|
||||||
$subject->setSearchService(
|
$subject->setSearchService(
|
||||||
$this->getMockBuilder(SearchService::class)
|
$this->getMockBuilder(SearchServiceInterface::class)
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock()
|
->getMock()
|
||||||
);
|
);
|
||||||
|
@ -118,8 +118,7 @@ class SearchRequestTest extends AbstractUnitTestCase
|
||||||
*/
|
*/
|
||||||
public function executionMakesUseOfProvidedConnectionAndSearchService()
|
public function executionMakesUseOfProvidedConnectionAndSearchService()
|
||||||
{
|
{
|
||||||
$searchServiceMock = $this->getMockBuilder(SearchService::class)
|
$searchServiceMock = $this->getMockBuilder(SearchServiceInterface::class)
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
->getMock();
|
||||||
$connectionMock = $this->getMockBuilder(ConnectionInterface::class)
|
$connectionMock = $this->getMockBuilder(ConnectionInterface::class)
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
Loading…
Reference in a new issue