You are here

protected function AmpTestBase::bodyText in Accelerated Mobile Pages (AMP) 8.3

Helper function to populate body text.

3 calls to AmpTestBase::bodyText()
AmpFormatterTextTest::createAmpNode in tests/src/Functional/AmpFormatterTextTest.php
Create a node with desired content for testing.
AmpFormatterTextTrimmedTest::createAmpNode in tests/src/Functional/AmpFormatterTextTrimmedTest.php
Create a node with desired content for testing.
AmpTestBase::createAmpNode in tests/src/Functional/AmpTestBase.php
Create a node with desired content for testing.

File

tests/src/Functional/AmpTestBase.php, line 221

Class

AmpTestBase
Base AMP testing setup.

Namespace

Drupal\Tests\amp\Functional

Code

protected function bodyText() {
  $max = mt_rand(10, 15);
  $words = [];
  for ($i = 0; $i < $max; $i++) {
    $words[] = $this
      ->randomMachineName(mt_rand(4, 10));
  }
  return '<p>' . ucfirst(implode(' ', $words) . '.</p>');
}