forked from mediamosa/mediamosa-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mediamosa_sdk.test
47 lines (39 loc) · 1.4 KB
/
mediamosa_sdk.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* @file
* Simpletest for MediaMosa SDK.
*/
/**
* SDK Functional tests.
*/
class MediaMosaSDKUnitTestCase extends DrupalUnitTestCase {
// ------------------------------------------------------------------ Members.
// ---------------------------------------------------------------- Functions.
public static function getInfo() {
return array(
'name' => 'MediaMosa - SDK - Functional tests',
'description' => 'Tests for functions that do not use database.',
'group' => 'MediaMosa SDK',
);
}
/**
* Tests for encoding tags;
*/
public function testEncodeTag() {
$got = mediamosa_sdk::metadata_encode_tag('animals', array('instinct', 'dinos'));
$expecting = '0.animals/1.instinct/2.dinos/';
// First test, normal tag build up.
$this->assert($got === $expecting, t('Expecting @expecting, got @got', array('@expecting' => $expecting, '@got' => $got)));
$got = mediamosa_sdk::metadata_encode_tag(
array('pattern' => '{term}*', 'vars' => array('{term}' => 'ani')),
array(
array('pattern' => '*'),
array('pattern' => '{term}', 'vars' => array('{term}' => 'di/nos')),
'bar',
)
);
$expecting = '0.ani*/1.*/2.di%2Fnos/3.bar/';
// Second test, complex tag build up for CQL.
$this->assert($got === $expecting, t('Expecting @expecting, got @got', array('@expecting' => $expecting, '@got' => $got)));
}
}