AmpFormatterTwitterTest.php in Accelerated Mobile Pages (AMP) 8.3
File
tests/src/Functional/AmpFormatterTwitterTest.php
View source
<?php
namespace Drupal\Tests\amp\Functional;
class AmpFormatterTwitterTest extends AmpFormatterTestBase {
protected $ampFormatterType = 'amp_social_post_formatter';
protected $ampFormatterSettings = [
'layout' => 'responsive',
'width' => 16,
'height' => 9,
'provider' => [
'twitter' => 'twitter',
],
'data-embed-as' => 'post',
'data-align-center' => '',
'placeholder' => '',
];
protected $ampElementName = 'amp-twitter';
protected function setUp() {
parent::setUp();
$this
->createTextField($this->fieldName);
$this
->configureDisplay();
}
public function createAmpNode() {
parent::createAmpNode();
$values = [
[
'value' => 'https://twitter.com/andyserkis/status/704420904437043200',
],
[
'value' => 'https://twitter.com/andyserkis/statuses/704420904437043200',
],
];
$this->node
->set($this->fieldName, $values)
->save();
$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>',
];
}
}