assertAggregate example

    $style_elements = $page->findAll('xpath', '//link[@href and @rel="stylesheet"]');
    $script_elements = $page->findAll('xpath', '//script[@src]');
    $style_urls = [];
    foreach ($style_elements as $element) {
      $style_urls[] = $element->getAttribute('href');
    }
    $script_urls = [];
    foreach ($script_elements as $element) {
      $script_urls[] = $element->getAttribute('src');
    }
    foreach ($style_urls as $url) {
      $this->assertAggregate($url, TRUE, 'text/css');
      // Once the file has been requested once, it's on disk. It is possible for       // a second request to hit the controller, and then find that another       // request has created the file already. Actually simulating this race       // condition is not really possible since it relies on timing. However, by       // changing the case of the part of the URL that is handled by Drupal       // routing, we can force the request to be served by Drupal.       $this->assertAggregate(str_replace($this->fileAssetsPath, strtoupper($this->fileAssetsPath)$url), TRUE, 'text/css');
      $this->assertAggregate($url, FALSE, 'text/css');
      $this->assertInvalidAggregates($url);
    }

    
Home | Imprint | This part of the site doesn't use cookies.