Loading core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php +1 −9 Original line number Diff line number Diff line Loading @@ -52,15 +52,7 @@ public function testApplies($expected, $route_name = NULL, $parameter_map = []) $translation_manager = $this->createMock('Drupal\Core\StringTranslation\TranslationInterface'); // Make an object to test. $builder = $this->getMockBuilder('Drupal\forum\Breadcrumb\ForumListingBreadcrumbBuilder') ->setConstructorArgs([ $entity_type_manager, $config_factory, $forum_manager, $translation_manager, ]) ->onlyMethods([]) ->getMock(); $builder = new ForumListingBreadcrumbBuilder($entity_type_manager, $config_factory, $forum_manager, $translation_manager); $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface'); $route_match->expects($this->once()) Loading core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php +1 −11 Original line number Diff line number Diff line Loading @@ -57,17 +57,7 @@ public function testApplies($expected, $route_name = NULL, $parameter_map = []) $translation_manager = $this->createMock('Drupal\Core\StringTranslation\TranslationInterface'); // Make an object to test. $builder = $this->getMockBuilder('Drupal\forum\Breadcrumb\ForumNodeBreadcrumbBuilder') ->setConstructorArgs( [ $entity_type_manager, $config_factory, $forum_manager, $translation_manager, ] ) ->onlyMethods([]) ->getMock(); $builder = new ForumNodeBreadcrumbBuilder($entity_type_manager, $config_factory, $forum_manager, $translation_manager); $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface'); $route_match->expects($this->once()) Loading core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php +4 −7 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Drupal\Tests\views\Unit\Controller; use Drupal\Core\Render\RenderContext; use Drupal\Core\Render\Renderer; use Drupal\Tests\UnitTestCase; use Drupal\views\Ajax\ViewAjaxResponse; use Drupal\views\Controller\ViewAjaxController; Loading Loading @@ -94,7 +95,7 @@ protected function setUp(): void { $element_info_manager = $this->createMock('\Drupal\Core\Render\ElementInfoManagerInterface'); $request_stack = new RequestStack(); $request_stack->push(new Request()); $args = [ $this->renderer = new Renderer( $this->createMock('\Drupal\Core\Controller\ControllerResolverInterface'), $this->createMock('\Drupal\Core\Theme\ThemeManagerInterface'), $element_info_manager, Loading @@ -106,12 +107,8 @@ protected function setUp(): void { 'languages:language_interface', 'theme', ], ], ]; $this->renderer = $this->getMockBuilder('Drupal\Core\Render\Renderer') ->setConstructorArgs($args) ->onlyMethods([]) ->getMock(); ] ); $container = new ContainerBuilder(); $container->set('renderer', $this->renderer); \Drupal::setContainer($container); Loading core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php +5 −8 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ use Drupal\Core\TypedData\TypedDataManagerInterface; use Drupal\Tests\UnitTestCase; use Drupal\Core\Language\Language; use Symfony\Component\Validator\ConstraintViolationList; use Symfony\Component\Validator\Validator\ValidatorInterface; /** Loading Loading @@ -417,10 +418,8 @@ public function testTypedData(bool $bundle_typed_data_definition, bool $entity_t */ public function testValidate() { $validator = $this->createMock(ValidatorInterface::class); /** @var \Symfony\Component\Validator\ConstraintViolationList|\PHPUnit\Framework\MockObject\MockObject $empty_violation_list */ $empty_violation_list = $this->getMockBuilder('\Symfony\Component\Validator\ConstraintViolationList') ->onlyMethods([]) ->getMock(); /** @var \Symfony\Component\Validator\ConstraintViolationList $empty_violation_list */ $empty_violation_list = new ConstraintViolationList(); $non_empty_violation_list = clone $empty_violation_list; $violation = $this->createMock('\Symfony\Component\Validator\ConstraintViolationInterface'); $non_empty_violation_list->add($violation); Loading @@ -446,10 +445,8 @@ public function testValidate() { */ public function testRequiredValidation() { $validator = $this->createMock(ValidatorInterface::class); /** @var \Symfony\Component\Validator\ConstraintViolationList|\PHPUnit\Framework\MockObject\MockObject $empty_violation_list */ $empty_violation_list = $this->getMockBuilder('\Symfony\Component\Validator\ConstraintViolationList') ->onlyMethods([]) ->getMock(); /** @var \Symfony\Component\Validator\ConstraintViolationList $empty_violation_list */ $empty_violation_list = new ConstraintViolationList(); $validator->expects($this->once()) ->method('validate') ->with($this->entity->getTypedData()) Loading core/tests/Drupal/Tests/Core/Form/FormTestBase.php +2 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Core\Form\FormInterface; use Drupal\Core\Form\FormState; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormValidator; use Drupal\Tests\UnitTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; Loading Loading @@ -179,10 +180,7 @@ protected function setUp(): void { $this->requestStack->push($this->request); $this->logger = $this->createMock('Drupal\Core\Logger\LoggerChannelInterface'); $form_error_handler = $this->createMock('Drupal\Core\Form\FormErrorHandlerInterface'); $this->formValidator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([$this->requestStack, $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $form_error_handler]) ->onlyMethods([]) ->getMock(); $this->formValidator = new FormValidator($this->requestStack, $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $form_error_handler); $this->formSubmitter = $this->getMockBuilder('Drupal\Core\Form\FormSubmitter') ->setConstructorArgs([$this->requestStack, $this->urlGenerator]) ->onlyMethods(['batchGet']) Loading Loading
core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php +1 −9 Original line number Diff line number Diff line Loading @@ -52,15 +52,7 @@ public function testApplies($expected, $route_name = NULL, $parameter_map = []) $translation_manager = $this->createMock('Drupal\Core\StringTranslation\TranslationInterface'); // Make an object to test. $builder = $this->getMockBuilder('Drupal\forum\Breadcrumb\ForumListingBreadcrumbBuilder') ->setConstructorArgs([ $entity_type_manager, $config_factory, $forum_manager, $translation_manager, ]) ->onlyMethods([]) ->getMock(); $builder = new ForumListingBreadcrumbBuilder($entity_type_manager, $config_factory, $forum_manager, $translation_manager); $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface'); $route_match->expects($this->once()) Loading
core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php +1 −11 Original line number Diff line number Diff line Loading @@ -57,17 +57,7 @@ public function testApplies($expected, $route_name = NULL, $parameter_map = []) $translation_manager = $this->createMock('Drupal\Core\StringTranslation\TranslationInterface'); // Make an object to test. $builder = $this->getMockBuilder('Drupal\forum\Breadcrumb\ForumNodeBreadcrumbBuilder') ->setConstructorArgs( [ $entity_type_manager, $config_factory, $forum_manager, $translation_manager, ] ) ->onlyMethods([]) ->getMock(); $builder = new ForumNodeBreadcrumbBuilder($entity_type_manager, $config_factory, $forum_manager, $translation_manager); $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface'); $route_match->expects($this->once()) Loading
core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php +4 −7 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Drupal\Tests\views\Unit\Controller; use Drupal\Core\Render\RenderContext; use Drupal\Core\Render\Renderer; use Drupal\Tests\UnitTestCase; use Drupal\views\Ajax\ViewAjaxResponse; use Drupal\views\Controller\ViewAjaxController; Loading Loading @@ -94,7 +95,7 @@ protected function setUp(): void { $element_info_manager = $this->createMock('\Drupal\Core\Render\ElementInfoManagerInterface'); $request_stack = new RequestStack(); $request_stack->push(new Request()); $args = [ $this->renderer = new Renderer( $this->createMock('\Drupal\Core\Controller\ControllerResolverInterface'), $this->createMock('\Drupal\Core\Theme\ThemeManagerInterface'), $element_info_manager, Loading @@ -106,12 +107,8 @@ protected function setUp(): void { 'languages:language_interface', 'theme', ], ], ]; $this->renderer = $this->getMockBuilder('Drupal\Core\Render\Renderer') ->setConstructorArgs($args) ->onlyMethods([]) ->getMock(); ] ); $container = new ContainerBuilder(); $container->set('renderer', $this->renderer); \Drupal::setContainer($container); Loading
core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php +5 −8 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ use Drupal\Core\TypedData\TypedDataManagerInterface; use Drupal\Tests\UnitTestCase; use Drupal\Core\Language\Language; use Symfony\Component\Validator\ConstraintViolationList; use Symfony\Component\Validator\Validator\ValidatorInterface; /** Loading Loading @@ -417,10 +418,8 @@ public function testTypedData(bool $bundle_typed_data_definition, bool $entity_t */ public function testValidate() { $validator = $this->createMock(ValidatorInterface::class); /** @var \Symfony\Component\Validator\ConstraintViolationList|\PHPUnit\Framework\MockObject\MockObject $empty_violation_list */ $empty_violation_list = $this->getMockBuilder('\Symfony\Component\Validator\ConstraintViolationList') ->onlyMethods([]) ->getMock(); /** @var \Symfony\Component\Validator\ConstraintViolationList $empty_violation_list */ $empty_violation_list = new ConstraintViolationList(); $non_empty_violation_list = clone $empty_violation_list; $violation = $this->createMock('\Symfony\Component\Validator\ConstraintViolationInterface'); $non_empty_violation_list->add($violation); Loading @@ -446,10 +445,8 @@ public function testValidate() { */ public function testRequiredValidation() { $validator = $this->createMock(ValidatorInterface::class); /** @var \Symfony\Component\Validator\ConstraintViolationList|\PHPUnit\Framework\MockObject\MockObject $empty_violation_list */ $empty_violation_list = $this->getMockBuilder('\Symfony\Component\Validator\ConstraintViolationList') ->onlyMethods([]) ->getMock(); /** @var \Symfony\Component\Validator\ConstraintViolationList $empty_violation_list */ $empty_violation_list = new ConstraintViolationList(); $validator->expects($this->once()) ->method('validate') ->with($this->entity->getTypedData()) Loading
core/tests/Drupal/Tests/Core/Form/FormTestBase.php +2 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Core\Form\FormInterface; use Drupal\Core\Form\FormState; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Form\FormValidator; use Drupal\Tests\UnitTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; Loading Loading @@ -179,10 +180,7 @@ protected function setUp(): void { $this->requestStack->push($this->request); $this->logger = $this->createMock('Drupal\Core\Logger\LoggerChannelInterface'); $form_error_handler = $this->createMock('Drupal\Core\Form\FormErrorHandlerInterface'); $this->formValidator = $this->getMockBuilder('Drupal\Core\Form\FormValidator') ->setConstructorArgs([$this->requestStack, $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $form_error_handler]) ->onlyMethods([]) ->getMock(); $this->formValidator = new FormValidator($this->requestStack, $this->getStringTranslationStub(), $this->csrfToken, $this->logger, $form_error_handler); $this->formSubmitter = $this->getMockBuilder('Drupal\Core\Form\FormSubmitter') ->setConstructorArgs([$this->requestStack, $this->urlGenerator]) ->onlyMethods(['batchGet']) Loading