Loading core/modules/contact/tests/src/Unit/MailHandlerTest.php +2 −1 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountInterface; use Drupal\Tests\UnitTestCase; use Drupal\user\Entity\User; /** * @coversDefaultClass \Drupal\contact\MailHandler Loading Loading @@ -292,7 +293,7 @@ public function getSendMailMessages() { * Mock sender for testing. */ protected function getMockSender($anonymous = TRUE, $mail_address = 'anonymous@drupal.org') { $sender = $this->createMock('\Drupal\Core\Session\AccountInterface'); $sender = $this->createMock(User::class); $sender->expects($this->once()) ->method('isAnonymous') ->willReturn($anonymous); Loading core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php +5 −9 Original line number Diff line number Diff line Loading @@ -262,20 +262,16 @@ public function testFieldComponent() { $this->assertEquals($default_formatter, $formatter->getPluginId()); $this->assertEquals($formatter_settings, $formatter->getSettings()); // Check that the formatter is statically persisted, by assigning an // arbitrary property and reading it back. $random_value = $this->randomString(); $formatter->randomValue = $random_value; $formatter = $display->getRenderer($field_name); $this->assertEquals($random_value, $formatter->randomValue); // Check that the formatter is statically persisted. $this->assertSame($formatter, $display->getRenderer($field_name)); // Check that changing the definition creates a new formatter. $display->setComponent($field_name, [ 'type' => 'field_test_multiple', ]); $formatter = $display->getRenderer($field_name); $this->assertEquals('field_test_multiple', $formatter->getPluginId()); $this->assertFalse(isset($formatter->randomValue)); $renderer = $display->getRenderer($field_name); $this->assertEquals('field_test_multiple', $renderer->getPluginId()); $this->assertNotSame($formatter, $renderer); // Check that the display has dependencies on the field and the module that // provides the formatter. Loading core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php +5 −9 Original line number Diff line number Diff line Loading @@ -103,20 +103,16 @@ public function testFieldComponent() { $this->assertEquals($default_widget, $widget->getPluginId()); $this->assertEquals($widget_settings, $widget->getSettings()); // Check that the widget is statically persisted, by assigning an // arbitrary property and reading it back. $random_value = $this->randomString(); $widget->randomValue = $random_value; $widget = $form_display->getRenderer($field_name); $this->assertEquals($random_value, $widget->randomValue); // Check that the widget is statically persisted. $this->assertSame($widget, $form_display->getRenderer($field_name)); // Check that changing the definition creates a new widget. $form_display->setComponent($field_name, [ 'type' => 'field_test_multiple', ]); $widget = $form_display->getRenderer($field_name); $this->assertEquals('test_field_widget', $widget->getPluginId()); $this->assertFalse(isset($widget->randomValue)); $renderer = $form_display->getRenderer($field_name); $this->assertEquals('test_field_widget', $renderer->getPluginId()); $this->assertNotSame($widget, $renderer); // Check that specifying an unknown widget (e.g. case of a disabled module) // gets stored as is in the display, but results in the default widget being Loading core/modules/node/tests/src/Unit/NodeOperationAccessTest.php +0 −6 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\RevisionableEntityBundleInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; Loading Loading @@ -118,11 +117,6 @@ public function testRevisionOperations($operation, array $hasPermissionMap, $ass $accessControl = new NodeAccessControlHandler($entityType, $grants, $entityTypeManager); $accessControl->setModuleHandler($moduleHandler); $nodeType = $this->createMock(RevisionableEntityBundleInterface::class); $typeProperty = new \stdClass(); $typeProperty->entity = $nodeType; $node->type = $typeProperty; $access = $accessControl->access($node, $operation, $account, FALSE); $this->assertEquals($assertAccess, $access); } Loading core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php +4 −3 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\Tests\serialization\Unit\Normalizer; use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeRepositoryInterface; Loading Loading @@ -187,7 +188,7 @@ public function testDenormalizeWithValidBundle() { $key_1 = $this->createMock(FieldItemListInterface::class); $key_2 = $this->createMock(FieldItemListInterface::class); $entity = $this->createMock(FieldableEntityInterface::class); $entity = $this->createMock(ContentEntityBase::class); $entity->expects($this->exactly(2)) ->method('get') ->willReturnMap([ Loading Loading @@ -340,7 +341,7 @@ public function testDenormalizeWithNoBundle() { $key_1 = $this->createMock(FieldItemListInterface::class); $key_2 = $this->createMock(FieldItemListInterface::class); $entity = $this->createMock(FieldableEntityInterface::class); $entity = $this->createMock(ContentEntityBase::class); $entity->expects($this->exactly(2)) ->method('get') ->willReturnMap([ Loading Loading @@ -409,7 +410,7 @@ public function testDenormalizeWithNoFieldableEntityType() { $storage->expects($this->once()) ->method('create') ->with($test_data) ->willReturn($this->createMock('Drupal\Core\Entity\EntityInterface')); ->willReturn($this->createMock(ContentEntityBase::class)); $this->entityTypeManager->expects($this->once()) ->method('getStorage') Loading Loading
core/modules/contact/tests/src/Unit/MailHandlerTest.php +2 −1 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Drupal\Core\Language\Language; use Drupal\Core\Session\AccountInterface; use Drupal\Tests\UnitTestCase; use Drupal\user\Entity\User; /** * @coversDefaultClass \Drupal\contact\MailHandler Loading Loading @@ -292,7 +293,7 @@ public function getSendMailMessages() { * Mock sender for testing. */ protected function getMockSender($anonymous = TRUE, $mail_address = 'anonymous@drupal.org') { $sender = $this->createMock('\Drupal\Core\Session\AccountInterface'); $sender = $this->createMock(User::class); $sender->expects($this->once()) ->method('isAnonymous') ->willReturn($anonymous); Loading
core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php +5 −9 Original line number Diff line number Diff line Loading @@ -262,20 +262,16 @@ public function testFieldComponent() { $this->assertEquals($default_formatter, $formatter->getPluginId()); $this->assertEquals($formatter_settings, $formatter->getSettings()); // Check that the formatter is statically persisted, by assigning an // arbitrary property and reading it back. $random_value = $this->randomString(); $formatter->randomValue = $random_value; $formatter = $display->getRenderer($field_name); $this->assertEquals($random_value, $formatter->randomValue); // Check that the formatter is statically persisted. $this->assertSame($formatter, $display->getRenderer($field_name)); // Check that changing the definition creates a new formatter. $display->setComponent($field_name, [ 'type' => 'field_test_multiple', ]); $formatter = $display->getRenderer($field_name); $this->assertEquals('field_test_multiple', $formatter->getPluginId()); $this->assertFalse(isset($formatter->randomValue)); $renderer = $display->getRenderer($field_name); $this->assertEquals('field_test_multiple', $renderer->getPluginId()); $this->assertNotSame($formatter, $renderer); // Check that the display has dependencies on the field and the module that // provides the formatter. Loading
core/modules/field_ui/tests/src/Kernel/EntityFormDisplayTest.php +5 −9 Original line number Diff line number Diff line Loading @@ -103,20 +103,16 @@ public function testFieldComponent() { $this->assertEquals($default_widget, $widget->getPluginId()); $this->assertEquals($widget_settings, $widget->getSettings()); // Check that the widget is statically persisted, by assigning an // arbitrary property and reading it back. $random_value = $this->randomString(); $widget->randomValue = $random_value; $widget = $form_display->getRenderer($field_name); $this->assertEquals($random_value, $widget->randomValue); // Check that the widget is statically persisted. $this->assertSame($widget, $form_display->getRenderer($field_name)); // Check that changing the definition creates a new widget. $form_display->setComponent($field_name, [ 'type' => 'field_test_multiple', ]); $widget = $form_display->getRenderer($field_name); $this->assertEquals('test_field_widget', $widget->getPluginId()); $this->assertFalse(isset($widget->randomValue)); $renderer = $form_display->getRenderer($field_name); $this->assertEquals('test_field_widget', $renderer->getPluginId()); $this->assertNotSame($widget, $renderer); // Check that specifying an unknown widget (e.g. case of a disabled module) // gets stored as is in the display, but results in the default widget being Loading
core/modules/node/tests/src/Unit/NodeOperationAccessTest.php +0 −6 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\RevisionableEntityBundleInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Session\AccountInterface; Loading Loading @@ -118,11 +117,6 @@ public function testRevisionOperations($operation, array $hasPermissionMap, $ass $accessControl = new NodeAccessControlHandler($entityType, $grants, $entityTypeManager); $accessControl->setModuleHandler($moduleHandler); $nodeType = $this->createMock(RevisionableEntityBundleInterface::class); $typeProperty = new \stdClass(); $typeProperty->entity = $nodeType; $node->type = $typeProperty; $access = $accessControl->access($node, $operation, $account, FALSE); $this->assertEquals($assertAccess, $access); } Loading
core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php +4 −3 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Drupal\Tests\serialization\Unit\Normalizer; use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeRepositoryInterface; Loading Loading @@ -187,7 +188,7 @@ public function testDenormalizeWithValidBundle() { $key_1 = $this->createMock(FieldItemListInterface::class); $key_2 = $this->createMock(FieldItemListInterface::class); $entity = $this->createMock(FieldableEntityInterface::class); $entity = $this->createMock(ContentEntityBase::class); $entity->expects($this->exactly(2)) ->method('get') ->willReturnMap([ Loading Loading @@ -340,7 +341,7 @@ public function testDenormalizeWithNoBundle() { $key_1 = $this->createMock(FieldItemListInterface::class); $key_2 = $this->createMock(FieldItemListInterface::class); $entity = $this->createMock(FieldableEntityInterface::class); $entity = $this->createMock(ContentEntityBase::class); $entity->expects($this->exactly(2)) ->method('get') ->willReturnMap([ Loading Loading @@ -409,7 +410,7 @@ public function testDenormalizeWithNoFieldableEntityType() { $storage->expects($this->once()) ->method('create') ->with($test_data) ->willReturn($this->createMock('Drupal\Core\Entity\EntityInterface')); ->willReturn($this->createMock(ContentEntityBase::class)); $this->entityTypeManager->expects($this->once()) ->method('getStorage') Loading