-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/3.x' into master
- Loading branch information
Showing
6 changed files
with
236 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
/** | ||
* @author Sullivan Senechal <[email protected]> | ||
*/ | ||
class AdminSearchBlockServiceTest extends BlockServiceTestCase | ||
final class AdminSearchBlockServiceTest extends BlockServiceTestCase | ||
{ | ||
/** | ||
* @var Pool | ||
|
@@ -47,7 +47,7 @@ protected function setUp(): void | |
parent::setUp(); | ||
|
||
$this->pool = $this->createMock(Pool::class); | ||
$this->searchHandler = $this->createMock(SearchHandler::class); | ||
$this->searchHandler = new SearchHandler(true); | ||
$this->templateRegistry = $this->createMock(TemplateRegistryInterface::class); | ||
$this->templateRegistry->method('getTemplate')->willReturn('@SonataAdmin/Block/block_search_result.html.twig'); | ||
} | ||
|
@@ -98,7 +98,12 @@ public function testGlobalSearchReturnsResponse(): void | |
|
||
public function testGlobalSearchReturnsEmptyWhenFiltersAreDisabled(): void | ||
{ | ||
$adminCode = 'code'; | ||
|
||
$admin = $this->createMock(AbstractAdmin::class); | ||
$admin | ||
->method('getCode') | ||
->willReturn($adminCode); | ||
|
||
$blockService = new AdminSearchBlockService( | ||
$this->twig, | ||
|
@@ -109,7 +114,7 @@ public function testGlobalSearchReturnsEmptyWhenFiltersAreDisabled(): void | |
); | ||
$blockContext = $this->getBlockContext($blockService); | ||
|
||
$this->searchHandler->expects(self::once())->method('search')->willReturn(null); | ||
$this->searchHandler->configureAdminSearch([$adminCode => false]); | ||
$this->pool->expects(self::once())->method('getAdminByAdminCode')->willReturn($admin); | ||
$admin->expects(self::once())->method('checkAccess')->with('list'); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.