AmpCSSTest.php in Accelerated Mobile Pages (AMP) 8.3        
                          
                  
                        
  
  
  
  
  
File
  tests/src/Functional/AmpCSSTest.php
  
    View source  
  <?php
namespace Drupal\Tests\amp\Functional;
class AmpCSSTest extends AmpTestBase {
  
  public function testCss() {
    
    $this
      ->createAmpNode();
    $text = $this->node
      ->get('body')->value;
    $title = $this->node
      ->get('title')->value;
    
    $this
      ->drupalGet($this
      ->nodeUrl());
    $this
      ->assertSession()
      ->statusCodeEquals(200);
    $this
      ->assertSession()
      ->responseContains($text);
    $this
      ->assertSession()
      ->responseContains($title);
    $relative_css = 'url(../../../../../../core/misc/icons/e29700/warning.svg)';
    $absolute_css = 'url(' . base_path() . 'core/themes/stable/images/core/icons/e29700/warning.svg)';
    
    $this
      ->drupalGet($this
      ->nodeAmpUrl());
    $this
      ->assertSession()
      ->statusCodeEquals(200);
    $this
      ->assertSession()
      ->responseContains($text);
    $this
      ->assertSession()
      ->responseContains($title);
    $this
      ->assertSession()
      ->responseNotContains($relative_css);
    $this
      ->assertSession()
      ->responseContains($absolute_css);
    $relative_css = 'url(../../../images/core/throbber-active.gif)';
    $absolute_css = 'url(' . base_path() . 'core/themes/stable/images/core/throbber-active.gif)';
    
    $this
      ->drupalGet($this
      ->nodeAmpUrl());
    $this
      ->assertSession()
      ->statusCodeEquals(200);
    $this
      ->assertSession()
      ->responseContains($text);
    $this
      ->assertSession()
      ->responseContains($title);
    $this
      ->assertSession()
      ->responseNotContains($relative_css);
    $this
      ->assertSession()
      ->responseContains($absolute_css);
  }
}