Issue#3376566: Display page title even it's zero.
Closes #3376566
Merge request reports
Activity
added 1 commit
added 716 commits
-
b92d1598...061989d4 - 714 commits from branch
project:11.x
- 635070fc - Issue#3376566: Display page title even it's zero.
- aae71cbb - Revert "Issue#3376566: Display page title even it's zero."
-
b92d1598...061989d4 - 714 commits from branch
109 99 // Test that the title appears as <title> when reloading the node page. 110 100 $this->drupalGet('node/' . $node->id()); 111 101 $this->assertSession()->responseContains('<title>' . $edge_case_title_escaped . ' | Drupal</title>'); 102 } 112 103 104 /** 105 * Data provider for testNodeWithTitle0(). 106 * 107 * @return array[][] 108 * The test cases. 109 */ 110 public function providerTestNodeWithTitle0() { changed this line in version 6 of the diff
114 ], 115 'Claro theme' => [ 116 'claro', 117 ], 118 'Olivero theme' => [ 119 'olivero', 120 ], 121 ]; 122 } 123 124 /** 125 * Creates one node with title 0 and tests if the node title has the correct value. 126 * 127 * @dataProvider providerTestNodeWithTitle0 128 */ 129 public function testNodeWithTitle0($theme) { changed this line in version 6 of the diff
20 20 %} 21 21 22 22 {{ title_prefix }} 23 {% if title|render|striptags|trim %} 23 {% if (title is not empty)|render|striptags|trim %} Yes, you're right but
(title is not empty) and title|render|striptags|trim
will not work as(title is not empty)
will return true buttitle|render|striptags|trim
will return '0' when the title is '0' and this is considered as false.Edited by Kunal Sachdev@smustgrave's question still applies: if
(title is not empty)
returns a boolean what purpose does it serve calling|render|striptags|trim
?Edited by Dave Longchanged this line in version 7 of the diff
125 * Creates one node with title 0 and tests if the node title has the correct value. 126 * 127 * @dataProvider providerTestNodeWithTitle0 128 */ 129 public function testNodeWithTitle0(string $theme): void { 130 if ($theme !== $this->defaultTheme) { 131 $system_theme_config = $this->container->get('config.factory') 132 ->getEditable('system.theme'); 133 $system_theme_config 134 ->set('default', $theme) 135 ->save(); 136 \Drupal::service('theme_installer')->install([$theme]); 137 } 138 $edit['admin_theme'] = $theme; 139 $this->drupalGet('admin/appearance'); 140 $this->submitForm($edit, 'Save configuration'); changed this line in version 8 of the diff
added 303 commits
-
f3f984f6...93b747d5 - 302 commits from branch
project:11.x
- ae25d121 - Merge branch drupal:11.x into 3376566-display-the-page
-
f3f984f6...93b747d5 - 302 commits from branch
111 101 // Test that the title appears as <title> when reloading the node page. 112 102 $this->drupalGet('node/' . $node->id()); 113 103 $this->assertSession()->responseContains('<title>' . $edge_case_title_escaped . ' | Drupal</title>'); 104 } 114 105 106 /** 107 * Creates one node with title 0 and tests if the node title has the correct value. 108 */ 109 public function testNodeWithTitle0(): void { I know that the existing test had a test for "0" title case but it was only tested for one theme. I added this test here because it tests other themes along with the olivero theme.
If we remove this test from here and shift the test in Olivero specific test class, then for testing claro also we'll have to add new test in Claro specific test class.
Edited by Kunal SachdevFeedback from @catch :
If we're going to test the same thing in three themes (and umami too, so maybe four?) then it should probably have a NodeTitleTest base class where only the theme name is required.
changed this line in version 12 of the diff
added 217 commits
-
ae25d121...229f626d - 216 commits from branch
project:11.x
- 99456754 - Merge branch drupal:11.x into 3376566-display-the-page
-
ae25d121...229f626d - 216 commits from branch
added 1 commit
- 71a84e58 - revert changes in core/modules/node/tests/src/Functional/NodeTitleTest.php
added 1 commit
- ca7b3c85 - add new test base and add different tests in respective themes