You are here

public function AmpFormatterTwitterTest::createAmpNode in Accelerated Mobile Pages (AMP) 8.3

Create a node with desired content for testing.

Overrides AmpTestBase::createAmpNode

File

tests/src/Functional/AmpFormatterTwitterTest.php, line 50

Class

AmpFormatterTwitterTest
Tests AMP Social Post Formatter.

Namespace

Drupal\Tests\amp\Functional

Code

public function createAmpNode() {
  parent::createAmpNode();
  $values = [
    [
      'value' => 'https://twitter.com/andyserkis/status/704420904437043200',
    ],
    [
      'value' => 'https://twitter.com/andyserkis/statuses/704420904437043200',
    ],
  ];

  // Create a new node with an social post url.
  $this->node
    ->set($this->fieldName, $values)
    ->save();

  // Test subparts of markup to avoid failures due to line breaks.
  $this->valuesOut = [
    '<amp-twitter layout="responsive" data-embed-as="post" height="9" width="16" data-tweetid="704420904437043200">',
    '</amp-twitter>',
    '<amp-twitter layout="responsive" data-embed-as="post" height="9" width="16" data-tweetid="704420904437043200">',
    '</amp-twitter>',
  ];
}