You are here

MediaFlickrUtils.test in Media: Flickr 7.2

Test Media Flickr unit tests.

File

tests/MediaFlickrUtils.test
View source
<?php

/**
 * @file
 * Test Media Flickr unit tests.
 */

/**
 * Test Media Flickr utils unit tests.
 */
class MediaFlickrUtils extends DrupalUnitTestCase {
  public static function getInfo() {
    return array(
      'name' => t('Basic utility test'),
      'description' => t('Test Media Flickr helper functions.'),
      'group' => t('Media Flickr'),
    );
  }
  public function setUp() {
    drupal_load('module', 'media_flickr');
    include_once __DIR__ . '/../includes/media_flickr.utilities.inc';
    parent::setUp();

    // TODO: Change the autogenerated stub
  }

  /**
   * Test Short URL format.
   */
  public function testShortUrl() {
    $this
      ->assertEqual('51773805699836', _media_flickr_shorturl('ps/zVhfY'), 'Short URL decoded correctly.');
  }

  /**
   * Test _media_flickr_guess_size().
   */
  public function testGuessSize() {
    $this
      ->assertNull(_media_flickr_guess_size(), 'Correctly returned null.');
    $this
      ->assertIdentical(_media_flickr_guess_size(), 0, 'Correctly returned 0.');
    $this
      ->assertEqual(_media_flickr_guess_size(400), 3, 'Only width used.');
    $this
      ->assertEqual(_media_flickr_guess_size(NULL, 400), 3, 'Only height used.');
    $this
      ->assertEqual(_media_flickr_guess_size(800, 400), 4, 'Correctly picked largest.');
  }

  /**
   * Test _media_flickr_get_user_id().
   */
  public function testGetUserId() {
    $picture = array(
      'p' => 51213900443,
    );
    $this
      ->assertIdentical('', _media_flickr_get_user_id(array()), 'Correctly returned empty string.');
  }

}

Classes

Namesort descending Description
MediaFlickrUtils Test Media Flickr utils unit tests.