Verified Commit 5fd0284c authored by Dave Long's avatar Dave Long
Browse files

Issue #3339780 by Nikolas Haliotis, quietone: Move getContent and getContentUpdate inline

(cherry picked from commit e646c8e5)
parent d12b95d2
Loading
Loading
Loading
Loading
+7 −32
Original line number Diff line number Diff line
@@ -520,7 +520,10 @@ private function doNode($type) {

    // Create a node using the form in order to generate an add content event
    // (which is not triggered by drupalCreateNode).
    $edit = $this->getContent();
    $edit = [
      'title[0][value]' => $this->randomMachineName(8),
      'body[0][value]'  => $this->randomMachineName(32),
    ];
    $title = $edit['title[0][value]'];
    $this->drupalGet('node/add/' . $type);
    $this->submitForm($edit, 'Save');
@@ -529,7 +532,9 @@ private function doNode($type) {
    $node = $this->drupalGetNodeByTitle($title);
    $this->assertNotNull($node, new FormattableMarkup('Node @title was loaded', ['@title' => $title]));
    // Edit the node.
    $edit = $this->getContentUpdate($type);
    $edit = [
      'body[0][value]' => $this->randomMachineName(32),
    ];
    $this->drupalGet('node/' . $node->id() . '/edit');
    $this->submitForm($edit, 'Save');
    $this->assertSession()->statusCodeEquals(200);
@@ -571,36 +576,6 @@ private function doNode($type) {
    $this->assertSession()->pageTextContains('node/' . $node->id());
  }

  /**
   * Creates random content based on node content type.
   *
   * @return array
   *   Random content needed by various node types.
   */
  private function getContent() {
    $content = [
      'title[0][value]' => $this->randomMachineName(8),
      'body[0][value]' => $this->randomMachineName(32),
    ];
    return $content;
  }

  /**
   * Creates random content as an update based on node content type.
   *
   * @param string $type
   *   Node content type (e.g., 'article').
   *
   * @return array
   *   Random content needed by various node types.
   */
  private function getContentUpdate($type) {
    $content = [
      'body[0][value]' => $this->randomMachineName(32),
    ];
    return $content;
  }

  /**
   * Tests the addition and clearing of log events through the admin interface.
   *