You are here

function MediaTypeTest::testOrder in D7 Media 7

Ensures that the weight is respected when types are created.

Return value

unknown_type

File

test/media.types.test, line 68
Tests for media types.

Class

MediaTypeTest
Test media type creation and management.

Code

function testOrder() {
  $type = $this
    ->createType(array(
    'name' => 'last',
    'label' => 'Last',
    'weight' => 100,
  ));
  $type = $this
    ->createType(array(
    'name' => 'first',
    'label' => 'First',
  ));
  $types = media_type_get_types();
  $keys = array_keys($types);
  $this
    ->assertTrue(isset($types['last']) && isset($types['first']), "Both types saved");
  $this
    ->assertTrue(array_search('last', $keys) > array_search('first', $keys), 'Type which was supposed to be first came first');
}