diff --git a/Classes/Connection/SearchRequestInterface.php b/Classes/Connection/SearchRequestInterface.php index d677886..221f078 100644 --- a/Classes/Connection/SearchRequestInterface.php +++ b/Classes/Connection/SearchRequestInterface.php @@ -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); } diff --git a/Classes/Domain/Model/SearchRequest.php b/Classes/Domain/Model/SearchRequest.php index fa05904..0d8865b 100644 --- a/Classes/Domain/Model/SearchRequest.php +++ b/Classes/Domain/Model/SearchRequest.php @@ -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 diff --git a/Tests/Unit/Domain/Model/SearchRequestTest.php b/Tests/Unit/Domain/Model/SearchRequestTest.php index 9dcc313..30e2495 100644 --- a/Tests/Unit/Domain/Model/SearchRequestTest.php +++ b/Tests/Unit/Domain/Model/SearchRequestTest.php @@ -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();