Commit 0263bee5 authored by catch's avatar catch
Browse files

task: #3618256 Adjust tests using olivero_test test module

By: quietone
By: smustgrave
By: dcam
parent a82a699c
Loading
Loading
Loading
Loading
Loading
+32 −2
Changes for core/.phpstan-baseline.php: 32 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -7549,6 +7549,12 @@
	'count' => 1,
	'path' => __DIR__ . '/lib/Drupal/Core/Installer/InstallerModuleExtensionList.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Core\\\\Installer\\\\InstallerRouteBuilder\\:\\:getRouteDefinitions\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/lib/Drupal/Core/Installer/InstallerRouteBuilder.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Core\\\\Installer\\\\InstallerServiceProvider\\:\\:alter\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -33364,10 +33370,34 @@
	'path' => __DIR__ . '/themes/olivero/src/OliveroPreRender.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Core\\\\Installer\\\\InstallerRouteBuilder\\:\\:getRouteDefinitions\\(\\) has no return type specified\\.$#',
	'message' => '#^Method Drupal\\\\Tests\\\\olivero\\\\Functional\\\\BreadcrumbTest\\:\\:assertBreadcrumb\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/lib/Drupal/Core/Installer/InstallerRouteBuilder.php',
	'path' => __DIR__ . '/themes/olivero/tests/src/Functional/BreadcrumbTest.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Tests\\\\olivero\\\\Functional\\\\BreadcrumbTest\\:\\:assertBreadcrumbParts\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/themes/olivero/tests/src/Functional/BreadcrumbTest.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Tests\\\\olivero\\\\Functional\\\\BreadcrumbTest\\:\\:assertMenuActiveTrail\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/themes/olivero/tests/src/Functional/BreadcrumbTest.php',
];
$ignoreErrors[] = [
	'message' => '#^Variable \\$parts in empty\\(\\) always exists and is always falsy\\.$#',
	'identifier' => 'empty.variable',
	'count' => 1,
	'path' => __DIR__ . '/themes/olivero/tests/src/Functional/BreadcrumbTest.php',
];
$ignoreErrors[] = [
	'message' => '#^Variable \\$trail in empty\\(\\) always exists and is always falsy\\.$#',
	'identifier' => 'empty.variable',
	'count' => 1,
	'path' => __DIR__ . '/themes/olivero/tests/src/Functional/BreadcrumbTest.php',
];
return ['parameters' => ['ignoreErrors' => $ignoreErrors]];
+7 −8
Changes for core/modules/comment/tests/src/Functional/CommentPreviewTest.php: 7 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -32,12 +32,12 @@ class CommentPreviewTest extends CommentTestBase {
  /**
   * {@inheritdoc}
   */
  protected static $modules = ['olivero_test', 'test_user_config'];
  protected static $modules = ['stark_test', 'test_user_config'];

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'olivero';
  protected $defaultTheme = 'stark';

  /**
   * Tests comment preview.
@@ -88,9 +88,6 @@ public function testCommentPreview(): void {
    $this->assertSession()->fieldValueEquals('subject[0][value]', $edit['subject[0][value]']);
    $this->assertSession()->fieldValueEquals('comment_body[0][value]', $edit['comment_body[0][value]']);

    // Check that the user picture is displayed.
    $this->assertSession()->elementExists('xpath', "//article[contains(@class, 'preview')]//div[contains(@class, 'user-picture')]//img");

    // Ensure that preview node is displayed after the submit buttons of the
    // form.
    $xpath = $this->assertSession()->buildXPathQuery('//div[@id=:id]/following-sibling::article', [':id' => 'edit-actions']);
@@ -129,14 +126,14 @@ public function testCommentPreviewDuplicateSubmission(): void {
    // Store the content of this page.
    $this->submitForm([], 'Save');
    $this->assertSession()->pageTextContains('Your comment has been posted.');
    $this->assertSession()->elementsCount('xpath', '//section[contains(@class, "comments")]/article', 1);
    $this->assertSession()->elementsCount('xpath', '//section/article', 1);

    // Go back and re-submit the form.
    $this->getSession()->getDriver()->back();
    $submit_button = $this->assertSession()->buttonExists('Save');
    $submit_button->click();
    $this->assertSession()->pageTextContains('Your comment has been posted.');
    $this->assertSession()->elementsCount('xpath', '//section[contains(@class, "comments")]/article', 2);
    $this->assertSession()->elementsCount('xpath', '//section/article', 2);
  }

  /**
@@ -163,7 +160,9 @@ public function testCommentEditPreviewSave(): void {
    $edit['date[date]'] = $date->format('Y-m-d');
    $edit['date[time]'] = $date->format('H:i:s');
    $raw_date = $date->getTimestamp();
    $expected_text_date = $this->container->get('date.formatter')->formatInterval(\Drupal::time()->getRequestTime() - $raw_date);
    // Olivero had a preprocessComment() hook that stark doesn't have. So let's
    // check for the date at least.
    $expected_text_date = $this->container->get('date.formatter')->format($raw_date);
    $expected_form_date = $date->format('Y-m-d');
    $expected_form_time = $date->format('H:i:s');
    $comment = $this->postComment($this->node, $edit['subject[0][value]'], $edit['comment_body[0][value]'], TRUE);
+0 −0

File moved.

+0 −0

File moved.

Loading