public function AmpFormatterTestBase::testFormatter in Accelerated Mobile Pages (AMP) 8.3
Test that the AMP formatter works.
File
- tests/
src/ Functional/ AmpFormatterTestBase.php, line 92
Class
- AmpFormatterTestBase
- Tests AMP Formatters.
Namespace
Drupal\Tests\amp\FunctionalCode
public function testFormatter() {
// Create a node with an image to test AMP formatter.
$this
->createAmpNode();
// Check the normal page is visible and contains the field.
$this
->drupalGet($this
->nodeUrl());
$this
->assertSession()
->statusCodeEquals(200);
if (!empty($this->ampElementName)) {
$this
->assertSession()
->responseNotContains('<' . $this->ampElementName);
}
// Check AMP page is visible and contains the expected markup.
$this
->drupalGet($this
->nodeAmpUrl());
$this
->assertSession()
->statusCodeEquals(200);
if (!empty($this->ampElementName)) {
$this
->assertSession()
->responseContains('<' . $this->ampElementName);
}
if (!empty($this->removedElementName)) {
$this
->assertSession()
->responseNotContains('<' . $this->removedElementName);
}
if (!empty($this->valuesOut)) {
foreach ($this->valuesOut as $value) {
$this
->assertSession()
->responseContains($value);
}
}
}