diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php index 4020b88..026154d 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php @@ -41,7 +41,6 @@ public function testSetException() { $class = new BarClass(); $this->setExpectedException(\InvalidArgumentException::class, 'Service ID names must be lowercase: Bar'); $container->set('Bar', $class); - $this->assertNotEquals('bar', $class->_serviceId); } /** diff --git a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php index d690f2a..6f20444 100644 --- a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php @@ -446,14 +446,14 @@ public function testSaveInvalid() { $this->setUpKeyValueEntityStorage(); $entity = $this->getMockEntity('Drupal\Core\Config\Entity\ConfigEntityBase'); - $this->setExpectedException(EntityMalformedException::class, 'The entity does not have an ID.'); - $this->entityStorage->save($entity); $this->keyValueStore->expects($this->never()) ->method('has'); $this->keyValueStore->expects($this->never()) ->method('set'); $this->keyValueStore->expects($this->never()) ->method('delete'); + $this->setExpectedException(EntityMalformedException::class, 'The entity does not have an ID.'); + $this->entityStorage->save($entity); } /** diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php index 6ac6cc1..08c1a6c 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php @@ -126,8 +126,6 @@ public function testDestinationRedirectToExternalUrl($request, $expected) { $event = new FilterResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST, $response); $this->setExpectedException(\PHPUnit_Framework_Error::class); $dispatcher->dispatch(KernelEvents::RESPONSE, $event); - - $this->assertEquals(400, $event->getResponse()->getStatusCode()); } /** @@ -176,8 +174,6 @@ public function testDestinationRedirectWithInvalidUrl(Request $request) { $event = new FilterResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST, $response); $this->setExpectedException(\PHPUnit_Framework_Error::class); $dispatcher->dispatch(KernelEvents::RESPONSE, $event); - - $this->assertEquals(400, $event->getResponse()->getStatusCode()); } /** diff --git a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php index 9958a8a..aa3739c 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php @@ -56,14 +56,9 @@ protected function setUp() { */ public function testGetFormIdWithString() { $form_arg = 'foo'; - - $clean_form_state = new FormState(); $form_state = new FormState(); $this->setExpectedException(\InvalidArgumentException::class, 'The form argument foo is not a valid form.'); - $form_id = $this->formBuilder->getFormId($form_arg, $form_state); - - $this->assertSame($form_arg, $form_id); - $this->assertSame($clean_form_state, $form_state); + $this->formBuilder->getFormId($form_arg, $form_state); } /** @@ -220,12 +215,8 @@ public function testHandleRedirectWithResponse() { */ public function testGetFormWithString() { $form_id = 'test_form_id'; - $expected_form = $form_id(); - $this->setExpectedException(\InvalidArgumentException::class, 'The form argument test_form_id is not a valid form.'); - $form = $this->formBuilder->getForm($form_id); - $this->assertFormElement($expected_form, $form, 'test'); - $this->assertSame('test-form-id', $form['#id']); + $this->formBuilder->getForm($form_id); } /** @@ -262,12 +253,8 @@ public function testGetFormWithClassString() { */ public function testBuildFormWithString() { $form_id = 'test_form_id'; - $expected_form = $form_id(); - $this->setExpectedException(\InvalidArgumentException::class, 'The form argument test_form_id is not a valid form.'); - $form = $this->formBuilder->getForm($form_id); - $this->assertFormElement($expected_form, $form, 'test'); - $this->assertArrayHasKey('#id', $form); + $this->formBuilder->getForm($form_id); } /** diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php index ff0bcd6..351788c 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php @@ -160,11 +160,10 @@ public function testIsCached($cache) { * @param bool $cache */ public function testSetCachedWithLogicException($cache) { - $this->setExpectedException(\LogicException::class); $this->decoratedFormState->setCached($cache) ->willThrow(\LogicException::class); - - $this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setCached($cache)); + $this->setExpectedException(\LogicException::class); + $this->formStateDecoratorBase->setCached($cache); } /** diff --git a/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php b/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php index fd4052e..53405f1 100644 --- a/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php @@ -97,12 +97,7 @@ public function testMatchRequestDenied() { ->with($request) ->willReturn($access_result); $this->setExpectedException(AccessDeniedHttpException::class); - $parameters = $this->router->matchRequest($request); - $expected = [ - AccessAwareRouterInterface::ACCESS_RESULT => $access_result, - ]; - $this->assertSame($expected, $request->attributes->all()); - $this->assertSame($expected, $parameters); + $this->router->matchRequest($request); } /**