diff --git a/core/modules/link/tests/src/Kernel/LinkItemSerializationTest.php b/core/modules/link/tests/src/Kernel/LinkItemSerializationTest.php index f0e71a659e62..36d5b97703d3 100644 --- a/core/modules/link/tests/src/Kernel/LinkItemSerializationTest.php +++ b/core/modules/link/tests/src/Kernel/LinkItemSerializationTest.php @@ -96,7 +96,7 @@ class LinkItemSerializationTest extends FieldKernelTestBase { ->set('query', $parsed_url['query']); $json = json_decode($this->serializer->serialize($entity, 'json'), TRUE); $json['field_test'][0]['options'] = 'string data'; - $serialized = json_encode($json, TRUE); + $serialized = json_encode($json); $this->expectException(\LogicException::class); $this->expectExceptionMessage('The generic FieldItemNormalizer cannot denormalize string values for "options" properties of the "field_test" field (field item class: Drupal\link\Plugin\Field\FieldType\LinkItem).'); $this->serializer->deserialize($serialized, EntityTest::class, 'json'); diff --git a/core/modules/mysql/tests/src/Kernel/mysql/TemporaryQueryTest.php b/core/modules/mysql/tests/src/Kernel/mysql/TemporaryQueryTest.php index 484ccc75227e..a2d7fcbabb86 100644 --- a/core/modules/mysql/tests/src/Kernel/mysql/TemporaryQueryTest.php +++ b/core/modules/mysql/tests/src/Kernel/mysql/TemporaryQueryTest.php @@ -23,7 +23,7 @@ class TemporaryQueryTest extends TemporaryQueryTestBase { // Assert that the table is indeed a temporary one. $temporary_table_info = $connection->query("SHOW CREATE TABLE {" . $table_name_test . "}")->fetchAssoc(); - $this->stringContains($temporary_table_info["Create Table"], "CREATE TEMPORARY TABLE"); + $this->assertStringContainsString('CREATE TEMPORARY TABLE', $temporary_table_info['Create Table']); // Assert that both have the same field names. $normal_table_fields = $connection->query("SELECT * FROM {test}")->fetch(); diff --git a/core/modules/node/tests/src/Kernel/Views/PathPluginTest.php b/core/modules/node/tests/src/Kernel/Views/PathPluginTest.php index aadfeaff4748..c4fbd04d314d 100644 --- a/core/modules/node/tests/src/Kernel/Views/PathPluginTest.php +++ b/core/modules/node/tests/src/Kernel/Views/PathPluginTest.php @@ -86,7 +86,7 @@ class PathPluginTest extends ViewsKernelTestBase { // Test with view_mode full. $output = $view->preview(); - $output = $renderer->renderRoot($output); + $output = (string) $renderer->renderRoot($output); foreach ($this->nodes as $node) { $this->assertStringContainsString('This is not escaped and this is ' . $node->toLink('the link')->toString(), $output, 'Make sure path field rewriting is not escaped.'); } diff --git a/core/modules/node/tests/src/Kernel/Views/RowPluginTest.php b/core/modules/node/tests/src/Kernel/Views/RowPluginTest.php index 4206fa9abf8b..251ee45dc50c 100644 --- a/core/modules/node/tests/src/Kernel/Views/RowPluginTest.php +++ b/core/modules/node/tests/src/Kernel/Views/RowPluginTest.php @@ -98,7 +98,7 @@ class RowPluginTest extends ViewsKernelTestBase { // Test with view_mode full. $output = $view->preview(); - $output = $renderer->renderRoot($output); + $output = (string) $renderer->renderRoot($output); foreach ($this->nodes as $node) { $this->assertStringNotContainsString($node->body->summary, $output, 'Make sure the teaser appears in the output of the view.'); $this->assertStringContainsString($node->body->value, $output, 'Make sure the full text appears in the output of the view.'); @@ -107,7 +107,7 @@ class RowPluginTest extends ViewsKernelTestBase { // Test with teasers. $view->rowPlugin->options['view_mode'] = 'teaser'; $output = $view->preview(); - $output = $renderer->renderRoot($output); + $output = (string) $renderer->renderRoot($output); foreach ($this->nodes as $node) { $this->assertStringContainsString($node->body->summary, $output, 'Make sure the teaser appears in the output of the view.'); $this->assertStringNotContainsString($node->body->value, $output); diff --git a/core/modules/user/tests/src/Kernel/WhoIsOnlineBlockTest.php b/core/modules/user/tests/src/Kernel/WhoIsOnlineBlockTest.php index ec84fcfacfbf..d634fa5291a6 100644 --- a/core/modules/user/tests/src/Kernel/WhoIsOnlineBlockTest.php +++ b/core/modules/user/tests/src/Kernel/WhoIsOnlineBlockTest.php @@ -115,7 +115,8 @@ class WhoIsOnlineBlockTest extends KernelTestBase { $this->assertText($user2->getAccountName(), 'Active user 2 found in online list.'); $this->assertNoText($user3->getAccountName(), 'Inactive user not found in online list.'); // Verify that online users are ordered correctly. - $this->assertGreaterThan(strpos($this->getRawContent(), $user2->getAccountName()), strpos($this->getRawContent(), $user1->getAccountName())); + $raw_content = (string) $this->getRawContent(); + $this->assertGreaterThan(strpos($raw_content, $user2->getAccountName()), strpos($raw_content, $user1->getAccountName())); } } diff --git a/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php index 34a7bdf0006b..1a38873a7144 100644 --- a/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php @@ -62,8 +62,10 @@ class PathValidatorTest extends KernelTestBase { } $this->container->set('router.request_context', new RequestContext()); } + else { + $requestContext->setMethod($method); + } - $requestContext->setMethod($method); /** @var \Drupal\Core\Url $url */ $url = $pathValidator->getUrlIfValidWithoutAccessCheck($entity->toUrl()->toString(TRUE)->getGeneratedUrl()); $this->assertEquals($method, $requestContext->getMethod()); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ClaroTableTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ClaroTableTest.php index 213f54b34e78..cb3e0ff35efa 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ClaroTableTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ClaroTableTest.php @@ -64,7 +64,7 @@ class ClaroTableTest extends KernelTestBase { ], ]; - $renderedTable = \Drupal::service('renderer')->renderRoot($table); + $renderedTable = (string) \Drupal::service('renderer')->renderRoot($table); // Confirm that table is rendered. $this->assertStringContainsString('class="class"', $renderedTable);