Loading core/lib/Drupal/Core/Test/AssertMailTrait.php +5 −2 Original line number Diff line number Diff line Loading @@ -57,12 +57,15 @@ protected function getMails(array $filter = []) { * this default. * * @return bool * TRUE on pass, FALSE on fail. * TRUE on pass. */ protected function assertMail($name, $value = '', $message = '', $group = 'Email') { $captured_emails = $this->container->get('state')->get('system.test_mail_collector') ?: []; $email = end($captured_emails); return $this->assertTrue($email && isset($email[$name]) && $email[$name] == $value, $message, $group); $this->assertIsArray($email, $message); $this->assertArrayHasKey($name, $email, $message); $this->assertEquals($value, $email[$name], $message); return TRUE; } /** Loading core/modules/big_pipe/tests/src/Functional/BigPipeTest.php +2 −1 Original line number Diff line number Diff line Loading @@ -269,7 +269,8 @@ public function testBigPipeNoJs() { $this->assertNoRaw(BigPipe::STOP_SIGNAL); // Verifying BigPipe assets are absent. $this->assertTrue(!isset($this->getDrupalSettings()['bigPipePlaceholderIds']) && empty($this->getDrupalSettings()['ajaxPageState']), 'BigPipe drupalSettings and BigPipe asset library absent.'); $this->assertArrayNotHasKey('bigPipePlaceholderIds', $this->getDrupalSettings()); $this->assertArrayNotHasKey('ajaxPageState', $this->getDrupalSettings()); $this->assertRaw('</body>'); // Verify that 4xx responses work fine. (4xx responses are handled by Loading core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php +3 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,9 @@ public function testBlockViewBuilderViewAlter() { $build = $this->getBlockRenderArray(); $this->assertFalse(isset($build['#prefix']), 'The appended #pre_render callback has not yet run before rendering.'); $this->assertIdentical((string) $this->renderer->renderRoot($build), 'Hiya!<br>'); $this->assertTrue(isset($build['#prefix']) && $build['#prefix'] === 'Hiya!<br>', 'A cached block without content is altered.'); // Check that a cached block without content is altered. $this->assertArrayHasKey('#prefix', $build); $this->assertSame('Hiya!<br>', $build['#prefix']); } /** Loading core/modules/block_content/tests/src/Kernel/Migrate/d6/MigrateBlockContentTest.php +4 −2 Original line number Diff line number Diff line Loading @@ -40,14 +40,16 @@ public function testBlockMigration() { /** @var \Drupal\block_content\Entity\BlockContent $block */ $block = BlockContent::load(1); $this->assertIdentical('My block 1', $block->label()); $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time()); $this->assertGreaterThanOrEqual(REQUEST_TIME, $block->getChangedTime()); $this->assertLessThanOrEqual(time(), $block->getChangedTime()); $this->assertIdentical('en', $block->language()->getId()); $this->assertIdentical('<h3>My first custom block body</h3>', $block->body->value); $this->assertIdentical('full_html', $block->body->format); $block = BlockContent::load(2); $this->assertIdentical('My block 2', $block->label()); $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time()); $this->assertGreaterThanOrEqual(REQUEST_TIME, $block->getChangedTime()); $this->assertLessThanOrEqual(time(), $block->getChangedTime()); $this->assertIdentical('en', $block->language()->getId()); $this->assertIdentical('<h3>My second custom block body</h3>', $block->body->value); $this->assertIdentical('full_html', $block->body->format); Loading core/modules/comment/tests/src/Functional/CommentInterfaceTest.php +4 −3 Original line number Diff line number Diff line Loading @@ -101,8 +101,8 @@ public function testCommentInterface() { // Test changing the comment author to "Anonymous". $comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), ['uid' => '']); $this->assertTrue($comment->getAuthorName() == 'Anonymous', 'Comment author successfully changed to anonymous.'); $this->assertTrue($comment->getOwnerId() == 0, 'Comment author successfully changed to anonymous.'); $this->assertSame('Anonymous', $comment->getAuthorName()); $this->assertEquals(0, $comment->getOwnerId()); // Test changing the comment author to an unverified user. $random_name = $this->randomMachineName(); Loading @@ -114,7 +114,8 @@ public function testCommentInterface() { // Test changing the comment author to a verified user. $this->drupalGet('comment/' . $comment->id() . '/edit'); $comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), ['uid' => $this->webUser->getAccountName() . ' (' . $this->webUser->id() . ')']); $this->assertTrue($comment->getAuthorName() == $this->webUser->getAccountName() && $comment->getOwnerId() == $this->webUser->id(), 'Comment author successfully changed to a registered user.'); $this->assertSame($this->webUser->getAccountName(), $comment->getAuthorName()); $this->assertSame($this->webUser->id(), $comment->getOwnerId()); $this->drupalLogout(); Loading Loading
core/lib/Drupal/Core/Test/AssertMailTrait.php +5 −2 Original line number Diff line number Diff line Loading @@ -57,12 +57,15 @@ protected function getMails(array $filter = []) { * this default. * * @return bool * TRUE on pass, FALSE on fail. * TRUE on pass. */ protected function assertMail($name, $value = '', $message = '', $group = 'Email') { $captured_emails = $this->container->get('state')->get('system.test_mail_collector') ?: []; $email = end($captured_emails); return $this->assertTrue($email && isset($email[$name]) && $email[$name] == $value, $message, $group); $this->assertIsArray($email, $message); $this->assertArrayHasKey($name, $email, $message); $this->assertEquals($value, $email[$name], $message); return TRUE; } /** Loading
core/modules/big_pipe/tests/src/Functional/BigPipeTest.php +2 −1 Original line number Diff line number Diff line Loading @@ -269,7 +269,8 @@ public function testBigPipeNoJs() { $this->assertNoRaw(BigPipe::STOP_SIGNAL); // Verifying BigPipe assets are absent. $this->assertTrue(!isset($this->getDrupalSettings()['bigPipePlaceholderIds']) && empty($this->getDrupalSettings()['ajaxPageState']), 'BigPipe drupalSettings and BigPipe asset library absent.'); $this->assertArrayNotHasKey('bigPipePlaceholderIds', $this->getDrupalSettings()); $this->assertArrayNotHasKey('ajaxPageState', $this->getDrupalSettings()); $this->assertRaw('</body>'); // Verify that 4xx responses work fine. (4xx responses are handled by Loading
core/modules/block/tests/src/Kernel/BlockViewBuilderTest.php +3 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,9 @@ public function testBlockViewBuilderViewAlter() { $build = $this->getBlockRenderArray(); $this->assertFalse(isset($build['#prefix']), 'The appended #pre_render callback has not yet run before rendering.'); $this->assertIdentical((string) $this->renderer->renderRoot($build), 'Hiya!<br>'); $this->assertTrue(isset($build['#prefix']) && $build['#prefix'] === 'Hiya!<br>', 'A cached block without content is altered.'); // Check that a cached block without content is altered. $this->assertArrayHasKey('#prefix', $build); $this->assertSame('Hiya!<br>', $build['#prefix']); } /** Loading
core/modules/block_content/tests/src/Kernel/Migrate/d6/MigrateBlockContentTest.php +4 −2 Original line number Diff line number Diff line Loading @@ -40,14 +40,16 @@ public function testBlockMigration() { /** @var \Drupal\block_content\Entity\BlockContent $block */ $block = BlockContent::load(1); $this->assertIdentical('My block 1', $block->label()); $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time()); $this->assertGreaterThanOrEqual(REQUEST_TIME, $block->getChangedTime()); $this->assertLessThanOrEqual(time(), $block->getChangedTime()); $this->assertIdentical('en', $block->language()->getId()); $this->assertIdentical('<h3>My first custom block body</h3>', $block->body->value); $this->assertIdentical('full_html', $block->body->format); $block = BlockContent::load(2); $this->assertIdentical('My block 2', $block->label()); $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time()); $this->assertGreaterThanOrEqual(REQUEST_TIME, $block->getChangedTime()); $this->assertLessThanOrEqual(time(), $block->getChangedTime()); $this->assertIdentical('en', $block->language()->getId()); $this->assertIdentical('<h3>My second custom block body</h3>', $block->body->value); $this->assertIdentical('full_html', $block->body->format); Loading
core/modules/comment/tests/src/Functional/CommentInterfaceTest.php +4 −3 Original line number Diff line number Diff line Loading @@ -101,8 +101,8 @@ public function testCommentInterface() { // Test changing the comment author to "Anonymous". $comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), ['uid' => '']); $this->assertTrue($comment->getAuthorName() == 'Anonymous', 'Comment author successfully changed to anonymous.'); $this->assertTrue($comment->getOwnerId() == 0, 'Comment author successfully changed to anonymous.'); $this->assertSame('Anonymous', $comment->getAuthorName()); $this->assertEquals(0, $comment->getOwnerId()); // Test changing the comment author to an unverified user. $random_name = $this->randomMachineName(); Loading @@ -114,7 +114,8 @@ public function testCommentInterface() { // Test changing the comment author to a verified user. $this->drupalGet('comment/' . $comment->id() . '/edit'); $comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), ['uid' => $this->webUser->getAccountName() . ' (' . $this->webUser->id() . ')']); $this->assertTrue($comment->getAuthorName() == $this->webUser->getAccountName() && $comment->getOwnerId() == $this->webUser->id(), 'Comment author successfully changed to a registered user.'); $this->assertSame($this->webUser->getAccountName(), $comment->getAuthorName()); $this->assertSame($this->webUser->id(), $comment->getOwnerId()); $this->drupalLogout(); Loading