Skip to content
Snippets Groups Projects

Issue #3155495 Refactor system/Kernel/Theme/ThemeTest::testThemeDataTypes

1 unresolved thread
1 unresolved thread

Rebased against 11.x

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Hardik Patel changed title from Rebased against 11.x to Issue #3155495 Refactor system/Kernel/Theme/ThemeTest::testThemeDataTypes

    changed title from Rebased against 11.x to Issue #3155495 Refactor system/Kernel/Theme/ThemeTest::testThemeDataTypes

  • quietone
    quietone @quietone started a thread on the diff
57 $types = ['null' => NULL, 'false' => FALSE, 'integer' => 1, 'string' => 'foo', 'empty_string' => ''];
57 $types = ['integer' => 1, 'string' => 'foo'];
58 58 foreach ($types as $type => $example) {
59 59 $output = \Drupal::theme()->render('theme_test_foo', ['foo' => $example]);
60 $this->assertTrue($output instanceof MarkupInterface || is_string($output), "\Drupal::theme() returns an object that implements MarkupInterface or a string for data type $type.");
61 if ($output instanceof MarkupInterface) {
62 $this->assertSame((string) $example, $output->__toString());
63 }
64 elseif (is_string($output)) {
65 $this->assertSame('', $output, 'A string will be return when the theme returns an empty string.');
66 }
60 $this->assertInstanceOf(MarkupInterface::class, $output, "\\Drupal::theme()->render() should return an object that implements MarkupInterface for data type '$type'.");
61 $this->assertEquals($example, $output);
62 }
63
64 // Check that a string is returned when the theme returns an empty string.
  • I had to read this a few times. At first I thought, "// Check a string is returned when the theme should return an empty string." would be better. But I think this can be even simpler.

    Suggested change
    64 // Check that a string is returned when the theme returns an empty string.
    64 // Check that a string is returned for special cases.
  • Please register or sign in to reply
Please register or sign in to reply
Loading