You are here

class OembedTestCase in oEmbed 8

Same name and namespace in other branches
  1. 7 oembed.test \OembedTestCase
  2. 7.0 oembed.test \OembedTestCase

Hierarchy

Expanded class hierarchy of OembedTestCase

File

./oembed.test, line 106
Tests for oembed.module.

View source
class OembedTestCase extends OembedTestHelper {
  public static function getInfo() {
    return array(
      'name' => 'oEmbed requests',
      'description' => 'Tests oEmbed request handling.',
      'group' => 'oEmbed',
    );
  }

  /**
   * Tests that actual response type matches the expected response type.
   */
  function testOembedProviderUrls() {
    foreach ($this->urls as $url => $info) {
      foreach (array(
        'json',
        'xml',
      ) as $format) {
        $response = oembed_get_data($url, array(
          'format' => $format,
        ));
        $message = t('oEmbed @format response says @url is @type', array(
          '@url' => $url,
          '@type' => $info['type'],
          '@format' => $format,
        ));
        $this
          ->assertEqual($response['type'], $info['type'], $message);
      }
    }
  }

  /**
   * Tests the oembed render element types.
   */
  function testOembedRenderElements() {
    foreach ($this->urls as $url => $info) {
      $element = oembed_render_element('oembed', $url);
      $this
        ->assertRenderedElement($element, '//*');
      if (isset($info['thumbnail']) && $info['thumbnail']) {
        $element = oembed_render_element('oembed_thumbnail', $url);
        $this
          ->assertRenderedElement($element, '//img');
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
OembedTestCase::getInfo public static function
OembedTestCase::testOembedProviderUrls function Tests that actual response type matches the expected response type.
OembedTestCase::testOembedRenderElements function Tests the oembed render element types.
OembedTestHelper::$profile protected property
OembedTestHelper::$urls protected property
OembedTestHelper::assertFileEntityAccess function Asserts file_entity_access correctly grants or denies access.
OembedTestHelper::assertRenderedElement protected function
OembedTestHelper::setUp function 3
OembedTestHelper::xpathArgsFromAttributes protected function