class HttpAssetTest

Hierarchy

  • class \Assetic\Test\Asset\HttpAssetTest extends \Assetic\Test\Asset\PHPUnit_Framework_TestCase

Expanded class hierarchy of HttpAssetTest

File

drupal/core/vendor/kriswallsmith/assetic/tests/Assetic/Test/Asset/HttpAssetTest.php, line 16

Namespace

Assetic\Test\Asset
View source
class HttpAssetTest extends \PHPUnit_Framework_TestCase {
  const JQUERY = 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js';
  public function testGetLastModified() {
    if (!extension_loaded('openssl')) {
      $this
        ->markTestSkipped('The OpenSSL extension is not loaded.');
    }
    $asset = new HttpAsset(self::JQUERY);
    $this
      ->assertInternalType('integer', $asset
      ->getLastModified(), '->getLastModified() returns an integer');
  }
  public function testProtocolRelativeUrl() {
    $asset = new HttpAsset(substr(self::JQUERY, 6));
    $asset
      ->load();
    $this
      ->assertNotEmpty($asset
      ->getContent());
  }
  public function testMalformedUrl() {
    $this
      ->setExpectedException('InvalidArgumentException');
    new HttpAsset(__FILE__);
  }
  public function testInvalidUrl() {
    $this
      ->setExpectedException('RuntimeException');
    $asset = new HttpAsset('http://invalid.com/foobar');
    $asset
      ->load();
  }
  public function testSourceMetadata() {
    $asset = new HttpAsset(self::JQUERY);
    $this
      ->assertEquals('https://ajax.googleapis.com', $asset
      ->getSourceRoot(), '->__construct() set the source root');
    $this
      ->assertEquals('ajax/libs/jquery/1.6.1/jquery.min.js', $asset
      ->getSourcePath(), '->__construct() set the source path');
  }

}

Members