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.
|
||||
*/
|
||||
|
||||
use Codappix\SearchCore\Domain\Search\SearchService;
|
||||
use Codappix\SearchCore\Domain\Search\SearchServiceInterface;
|
||||
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
|
||||
|
||||
interface SearchRequestInterface extends QueryInterface
|
||||
|
@ -54,5 +54,5 @@ interface SearchRequestInterface extends QueryInterface
|
|||
* Workaround for paginate widget support which will
|
||||
* 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\SearchRequestInterface;
|
||||
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 TYPO3\CMS\Core\Utility\ArrayUtility;
|
||||
|
||||
|
@ -69,7 +69,7 @@ class SearchRequest implements SearchRequestInterface
|
|||
protected $connection;
|
||||
|
||||
/**
|
||||
* @var SearchService
|
||||
* @var SearchServiceInterface
|
||||
*/
|
||||
protected $searchService;
|
||||
|
||||
|
@ -137,7 +137,7 @@ class SearchRequest implements SearchRequestInterface
|
|||
$this->connection = $connection;
|
||||
}
|
||||
|
||||
public function setSearchService(SearchService $searchService)
|
||||
public function setSearchService(SearchServiceInterface $searchService)
|
||||
{
|
||||
$this->searchService = $searchService;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ class SearchRequest implements SearchRequestInterface
|
|||
1502197732
|
||||
);
|
||||
}
|
||||
if (!($this->searchService instanceof SearchService)) {
|
||||
if (!($this->searchService instanceof SearchServiceInterface)) {
|
||||
throw new \InvalidArgumentException(
|
||||
'SearchService was not set before, therefore execute can not work. Use `setSearchService` before.',
|
||||
1520325175
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Codappix\SearchCore\Tests\Unit\Domain\Model;
|
|||
use Codappix\SearchCore\Connection\ConnectionInterface;
|
||||
use Codappix\SearchCore\Connection\SearchResultInterface;
|
||||
use Codappix\SearchCore\Domain\Model\SearchRequest;
|
||||
use Codappix\SearchCore\Domain\Search\SearchService;
|
||||
use Codappix\SearchCore\Domain\Search\SearchServiceInterface;
|
||||
use Codappix\SearchCore\Tests\Unit\AbstractUnitTestCase;
|
||||
|
||||
class SearchRequestTest extends AbstractUnitTestCase
|
||||
|
@ -105,7 +105,7 @@ class SearchRequestTest extends AbstractUnitTestCase
|
|||
{
|
||||
$subject = new SearchRequest();
|
||||
$subject->setSearchService(
|
||||
$this->getMockBuilder(SearchService::class)
|
||||
$this->getMockBuilder(SearchServiceInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock()
|
||||
);
|
||||
|
@ -118,8 +118,7 @@ class SearchRequestTest extends AbstractUnitTestCase
|
|||
*/
|
||||
public function executionMakesUseOfProvidedConnectionAndSearchService()
|
||||
{
|
||||
$searchServiceMock = $this->getMockBuilder(SearchService::class)
|
||||
->disableOriginalConstructor()
|
||||
$searchServiceMock = $this->getMockBuilder(SearchServiceInterface::class)
|
||||
->getMock();
|
||||
$connectionMock = $this->getMockBuilder(ConnectionInterface::class)
|
||||
->getMock();
|
||||
|
|
Loading…
Reference in a new issue