You are here

kaltura_notification.test in Kaltura 7.2

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

File

tests/kaltura_notification.test
View source
<?php

/**
 * 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/kaltura/general');
    $edit['first_name'] = 'name';
    $edit['last_name'] = 'last';
    $edit['email'] = $this
      ->randomname() . '@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';
    $kaltura_client = KalturaHelpers::getKalturaClient(TRUE);
    $session_user = KalturaHelpers::getSessionUser();
    $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.