Loading core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php +7 −2 Original line number Diff line number Diff line Loading @@ -54,7 +54,12 @@ protected function setUp(): void { ->getMock(); $this->managers[$type]->expects($this->once()) ->method('getDefinitions') ->will($this->returnValue(['aggregator_test' => ['title' => '', 'description' => '']])); ->willReturn([ 'aggregator_test' => [ 'title' => '', 'description' => '', ], ]); } /** @var \Drupal\Core\Messenger\MessengerInterface|\PHPUnit\Framework\MockObject\MockBuilder $messenger */ Loading Loading @@ -102,7 +107,7 @@ public function testSettingsForm() { $this->managers['processor']->expects($this->once()) ->method('createInstance') ->with($this->equalTo('aggregator_test')) ->will($this->returnValue($test_processor)); ->willReturn($test_processor); $form = $this->settingsForm->buildForm([], $form_state); $this->settingsForm->validateForm($form, $form_state); Loading core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php +4 −4 Original line number Diff line number Diff line Loading @@ -66,13 +66,13 @@ protected function setUp(): void { $this->entityType = $this->createMock('\Drupal\Core\Entity\EntityTypeInterface'); $this->entityType->expects($this->any()) ->method('getProvider') ->will($this->returnValue('block')); ->willReturn('block'); $this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class); $this->entityTypeManager->expects($this->any()) ->method('getDefinition') ->with($this->entityTypeId) ->will($this->returnValue($this->entityType)); ->willReturn($this->entityType); $this->uuid = $this->createMock('\Drupal\Component\Uuid\UuidInterface'); Loading Loading @@ -111,13 +111,13 @@ public function testCalculateDependencies() { $plugin_collection->expects($this->atLeastOnce()) ->method('get') ->with($instance_id) ->will($this->returnValue($instance)); ->willReturn($instance); $plugin_collection->addInstanceId($instance_id); // Return the mocked plugin collection. $entity->expects($this->once()) ->method('getPluginCollections') ->will($this->returnValue([$plugin_collection])); ->willReturn([$plugin_collection]); $dependencies = $entity->calculateDependencies()->getDependencies(); $this->assertContains('test', $dependencies['module']); Loading core/modules/block/tests/src/Unit/BlockFormTest.php +6 −6 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ protected function setUp(): void { $this->themeHandler = $this->createMock('Drupal\Core\Extension\ThemeHandlerInterface'); $this->entityTypeManager->expects($this->any()) ->method('getStorage') ->will($this->returnValue($this->storage)); ->willReturn($this->storage); $this->pluginFormFactory = $this->prophesize(PluginFormFactoryInterface::class); } Loading @@ -99,14 +99,14 @@ protected function getBlockMockWithMachineName($machine_name) { ->getMock(); $plugin->expects($this->any()) ->method('getMachineNameSuggestion') ->will($this->returnValue($machine_name)); ->willReturn($machine_name); $block = $this->getMockBuilder(Block::class) ->disableOriginalConstructor() ->getMock(); $block->expects($this->any()) ->method('getPlugin') ->will($this->returnValue($plugin)); ->willReturn($plugin); return $block; } Loading @@ -126,15 +126,15 @@ public function testGetUniqueMachineName() { $query = $this->createMock('Drupal\Core\Entity\Query\QueryInterface'); $query->expects($this->exactly(5)) ->method('condition') ->will($this->returnValue($query)); ->willReturn($query); $query->expects($this->exactly(5)) ->method('execute') ->will($this->returnValue(['test', 'other_test', 'other_test_1', 'other_test_2'])); ->willReturn(['test', 'other_test', 'other_test_1', 'other_test_2']); $this->storage->expects($this->exactly(5)) ->method('getQuery') ->will($this->returnValue($query)); ->willReturn($query); $block_form_controller = new BlockForm($this->entityTypeManager, $this->conditionManager, $this->contextRepository, $this->language, $this->themeHandler, $this->pluginFormFactory->reveal()); Loading core/modules/block/tests/src/Unit/BlockRepositoryTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ protected function setUp(): void { $theme_manager = $this->createMock('Drupal\Core\Theme\ThemeManagerInterface'); $theme_manager->expects($this->atLeastOnce()) ->method('getActiveTheme') ->will($this->returnValue($active_theme)); ->willReturn($active_theme); $this->contextHandler = $this->createMock('Drupal\Core\Plugin\Context\ContextHandlerInterface'); $this->blockStorage = $this->createMock('Drupal\Core\Entity\EntityStorageInterface'); Loading @@ -82,7 +82,7 @@ public function testGetVisibleBlocksPerRegion(array $blocks_config, array $expec $block = $this->createMock('Drupal\block\BlockInterface'); $block->expects($this->once()) ->method('access') ->will($this->returnValue($block_config[0])); ->willReturn($block_config[0]); $block->expects($block_config[0] ? $this->atLeastOnce() : $this->never()) ->method('getRegion') ->willReturn($block_config[1]); Loading core/modules/block/tests/src/Unit/CategoryAutocompleteTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ protected function setUp(): void { $block_manager = $this->createMock('Drupal\Core\Block\BlockManagerInterface'); $block_manager->expects($this->any()) ->method('getCategories') ->will($this->returnValue(['Comment', 'Node', 'None & Such', 'User'])); ->willReturn(['Comment', 'Node', 'None & Such', 'User']); $this->autocompleteController = new CategoryAutocompleteController($block_manager); } Loading Loading
core/modules/aggregator/tests/src/Unit/Plugin/AggregatorPluginSettingsBaseTest.php +7 −2 Original line number Diff line number Diff line Loading @@ -54,7 +54,12 @@ protected function setUp(): void { ->getMock(); $this->managers[$type]->expects($this->once()) ->method('getDefinitions') ->will($this->returnValue(['aggregator_test' => ['title' => '', 'description' => '']])); ->willReturn([ 'aggregator_test' => [ 'title' => '', 'description' => '', ], ]); } /** @var \Drupal\Core\Messenger\MessengerInterface|\PHPUnit\Framework\MockObject\MockBuilder $messenger */ Loading Loading @@ -102,7 +107,7 @@ public function testSettingsForm() { $this->managers['processor']->expects($this->once()) ->method('createInstance') ->with($this->equalTo('aggregator_test')) ->will($this->returnValue($test_processor)); ->willReturn($test_processor); $form = $this->settingsForm->buildForm([], $form_state); $this->settingsForm->validateForm($form, $form_state); Loading
core/modules/block/tests/src/Unit/BlockConfigEntityUnitTest.php +4 −4 Original line number Diff line number Diff line Loading @@ -66,13 +66,13 @@ protected function setUp(): void { $this->entityType = $this->createMock('\Drupal\Core\Entity\EntityTypeInterface'); $this->entityType->expects($this->any()) ->method('getProvider') ->will($this->returnValue('block')); ->willReturn('block'); $this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class); $this->entityTypeManager->expects($this->any()) ->method('getDefinition') ->with($this->entityTypeId) ->will($this->returnValue($this->entityType)); ->willReturn($this->entityType); $this->uuid = $this->createMock('\Drupal\Component\Uuid\UuidInterface'); Loading Loading @@ -111,13 +111,13 @@ public function testCalculateDependencies() { $plugin_collection->expects($this->atLeastOnce()) ->method('get') ->with($instance_id) ->will($this->returnValue($instance)); ->willReturn($instance); $plugin_collection->addInstanceId($instance_id); // Return the mocked plugin collection. $entity->expects($this->once()) ->method('getPluginCollections') ->will($this->returnValue([$plugin_collection])); ->willReturn([$plugin_collection]); $dependencies = $entity->calculateDependencies()->getDependencies(); $this->assertContains('test', $dependencies['module']); Loading
core/modules/block/tests/src/Unit/BlockFormTest.php +6 −6 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ protected function setUp(): void { $this->themeHandler = $this->createMock('Drupal\Core\Extension\ThemeHandlerInterface'); $this->entityTypeManager->expects($this->any()) ->method('getStorage') ->will($this->returnValue($this->storage)); ->willReturn($this->storage); $this->pluginFormFactory = $this->prophesize(PluginFormFactoryInterface::class); } Loading @@ -99,14 +99,14 @@ protected function getBlockMockWithMachineName($machine_name) { ->getMock(); $plugin->expects($this->any()) ->method('getMachineNameSuggestion') ->will($this->returnValue($machine_name)); ->willReturn($machine_name); $block = $this->getMockBuilder(Block::class) ->disableOriginalConstructor() ->getMock(); $block->expects($this->any()) ->method('getPlugin') ->will($this->returnValue($plugin)); ->willReturn($plugin); return $block; } Loading @@ -126,15 +126,15 @@ public function testGetUniqueMachineName() { $query = $this->createMock('Drupal\Core\Entity\Query\QueryInterface'); $query->expects($this->exactly(5)) ->method('condition') ->will($this->returnValue($query)); ->willReturn($query); $query->expects($this->exactly(5)) ->method('execute') ->will($this->returnValue(['test', 'other_test', 'other_test_1', 'other_test_2'])); ->willReturn(['test', 'other_test', 'other_test_1', 'other_test_2']); $this->storage->expects($this->exactly(5)) ->method('getQuery') ->will($this->returnValue($query)); ->willReturn($query); $block_form_controller = new BlockForm($this->entityTypeManager, $this->conditionManager, $this->contextRepository, $this->language, $this->themeHandler, $this->pluginFormFactory->reveal()); Loading
core/modules/block/tests/src/Unit/BlockRepositoryTest.php +2 −2 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ protected function setUp(): void { $theme_manager = $this->createMock('Drupal\Core\Theme\ThemeManagerInterface'); $theme_manager->expects($this->atLeastOnce()) ->method('getActiveTheme') ->will($this->returnValue($active_theme)); ->willReturn($active_theme); $this->contextHandler = $this->createMock('Drupal\Core\Plugin\Context\ContextHandlerInterface'); $this->blockStorage = $this->createMock('Drupal\Core\Entity\EntityStorageInterface'); Loading @@ -82,7 +82,7 @@ public function testGetVisibleBlocksPerRegion(array $blocks_config, array $expec $block = $this->createMock('Drupal\block\BlockInterface'); $block->expects($this->once()) ->method('access') ->will($this->returnValue($block_config[0])); ->willReturn($block_config[0]); $block->expects($block_config[0] ? $this->atLeastOnce() : $this->never()) ->method('getRegion') ->willReturn($block_config[1]); Loading
core/modules/block/tests/src/Unit/CategoryAutocompleteTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ protected function setUp(): void { $block_manager = $this->createMock('Drupal\Core\Block\BlockManagerInterface'); $block_manager->expects($this->any()) ->method('getCategories') ->will($this->returnValue(['Comment', 'Node', 'None & Such', 'User'])); ->willReturn(['Comment', 'Node', 'None & Such', 'User']); $this->autocompleteController = new CategoryAutocompleteController($block_manager); } Loading