You are here

public function KalturaUploadTestCase::testNotifications in Kaltura 7.2

Same name and namespace in other branches
  1. 7.3 tests/kaltura_notification.test \KalturaUploadTestCase::testNotifications()

File

tests/kaltura_notification.test, line 23

Class

KalturaUploadTestCase
Ensure that adding partner info works properly.

Code

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'));
}