You are here

kaltura_notification.test in Kaltura 7.3

Same filename and directory in other branches
  1. 7.2 tests/kaltura_notification.test

Tests functionality for notifications.

File

tests/kaltura_notification.test
View source
<?php

/**
 * @file
 * Tests functionality for notifications.
 */

/**
 * Ensure that adding partner info  works properly.
 */
class KalturaUploadTestCase extends DrupalWebTestCase {
  public static function getInfo() {
    return array(
      'name' => 'Notifications tests',
      'description' => 'Check the notifications received from kaltura',
      'group' => 'Kaltura',
    );
  }
  function setUp() {
    parent::setUp('kaltura');
    $admin_user = $this
      ->drupalCreateUser(array(
      'administer site configuration',
      'administer kaltura',
    ));
    $this
      ->drupalLogin($admin_user);
  }
  public function testNotifications() {
    $this
      ->drupalGet('admin/config/media/kaltura');
    $edit['first_name'] = 'name';
    $edit['last_name'] = 'last';
    $edit['email'] = $this
      ->randomname(16) . '@example.com';
    $edit['phone'] = '111111111';
    $edit['company'] = 'autotest';
    $edit['title'] = 'autotestbot';
    $edit['vertical'] = 'Media';
    $edit['country'] = 'IL';
    $edit['would_you_like_to_be_contacted'] = 'no';
    $edit['terms'] = TRUE;
    $this
      ->drupalPost(NULL, $edit, t('submit'));
    $this
      ->assertText(t('Congratulations!'), t('Make sure instaltion is complate'));
    $pid = variable_get('kaltura_partner_id', 'error');
    $path = drupal_get_path('module', 'kaltura') . '/tests/test.flv';
    $helpers = new KalturaHelpers();
    $kaltura_client = $helpers
      ->getKalturaClient(TRUE);
    $token = $kaltura_client->baseEntry
      ->upload($path);
    $entry = new KalturaBaseEntry();
    $entry->name = $this
      ->randomname();
    $res = $kaltura_client->baseEntry
      ->addFromUploadedFile($entry, $token, NULL);
    $eid = $res->id;
    $rows = db_select('node_kaltura', 'n')
      ->fields('n', array(
      'kaltura_entryid',
    ))
      ->condition('kaltura_entryid', $eid, '=')
      ->countQuery()
      ->execute()
      ->fetchField();
    $this
      ->assertEqual($rows, 1, t('check add entry notication'));

    // Change metadata.
    // Change title.
    $en = new KalturaBaseEntry();
    $name = $this
      ->randomname();
    $en->name = $name;
    $res = $kaltura_client->baseEntry
      ->update($eid, $en);
    $ename = db_select('node_kaltura', 'n')
      ->fields('n', array(
      'kaltura_title',
    ))
      ->condition('kaltura_entryid', $eid, '=')
      ->execute()
      ->fetchField();
    $this
      ->assertEqual($ename, $name, t('check change title notification'));

    // Change tags.
    $tags = $this
      ->randomname();
    $en->tags = $tags;
    $res = $kaltura_client->baseEntry
      ->update($eid, $en);
    $etags = db_select('node_kaltura', 'n')
      ->fields('n', array(
      'kaltura_tags',
    ))
      ->condition('kaltura_entryid', $eid, '=')
      ->execute()
      ->fetchField();
    $this
      ->assertEqual($etags, $tags, t('check change tags notification'));

    // Change description.
    $desc = $this
      ->randomname(32);
    $en->description = $desc;
    $res = $kaltura_client->baseEntry
      ->update($eid, $en);
    $edesc = db_select('node_kaltura', 'n')
      ->fields('n', array(
      'kaltura_description',
    ))
      ->condition('kaltura_entryid', $eid, '=')
      ->execute()
      ->fetchField();
    $this
      ->assertEqual($edesc, $desc, t('check change description notification'));
  }

}

Classes

Namesort descending Description
KalturaUploadTestCase Ensure that adding partner info works properly.