/
ConstantsTest.php
59 lines (48 loc) · 3.76 KB
/
ConstantsTest.php
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
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Copyright 2006 - 2012 Eric D. Hough (http://ehough.com)
*
* This file is part of TubePress (http://tubepress.org)
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
class tubepress_api_const_ConstantsTest extends TubePressUnitTest
{
function testConstants()
{
$toTest = array(
'tubepress_api_const_options_names_Advanced' => array('debugging_enabled', 'keyword', 'galleryId', 'https', 'httpMethod'),
'tubepress_api_const_options_names_Cache' => array('cacheEnabled', 'cacheCleaningFactor', 'cacheDirectory', 'cacheLifetimeSeconds'),
'tubepress_api_const_options_names_Embedded' => array('playerImplementation', 'embeddedHeight', 'embeddedWidth', 'lazyPlay', 'autoplay', 'loop', 'showInfo', 'playerLocation', 'autoNext', 'sequence', 'enableJsApi'),
'tubepress_api_const_options_names_Feed' => array('orderBy', 'videoBlacklist', 'resultCountCap', 'searchResultsRestrictedToUser', 'perPageSort'),
'tubepress_api_const_options_names_InteractiveSearch' => array('searchProvider', 'searchResultsDomId', 'searchResultsOnly', 'searchResultsUrl'),
'tubepress_api_const_options_names_Meta' => array('author', 'category', 'description', 'id', 'length', 'rating', 'ratings', 'likes', 'rating', 'ratings', 'tags', 'title', 'uploaded', 'url', 'views', 'dateFormat', 'descriptionLimit', 'relativeDates'),
'tubepress_api_const_options_names_OptionsUi' => array('disabledOptionsPageParticipants'),
'tubepress_api_const_options_names_Output' => array('mode', 'output', 'video'),
'tubepress_api_const_options_names_Thumbs' => array('theme', 'ajaxPagination', 'resultsPerPage', 'hqThumbs', 'thumbHeight', 'thumbWidth', 'fluidThumbs', 'paginationAbove', 'paginationBelow', 'randomize_thumbnails'),
'tubepress_api_const_options_values_OrderByValue' => array('commentCount', 'duration', 'newest', 'oldest', 'position', 'random', 'rating', 'relevance', 'title', 'viewCount'),
'tubepress_api_const_options_values_PerPageSortValue' => array('commentCount', 'duration', 'newest', 'oldest', 'random', 'rating', 'none', 'title', 'viewCount'),
'tubepress_api_const_options_values_PlayerImplementationValue' => array('provider_based'),
'tubepress_api_const_template_Variable' => array('autostart', 'bottomPagination', 'embeddedColorHightlight', 'embeddedColorPrimary', 'embeddedFullscreen', 'embeddedHeight', 'embeddedImplementationName', 'embeddedSource', 'embeddedWidth', 'galleryId', 'homeURL', 'metaLabels', 'playerName', 'preGallery', 'searchButton', 'searchHandlerUrl', 'searchHiddenInputs', 'searchTargetDomId', 'searchTerms', 'shouldShow', 'thumbHeight', 'thumbWidth', 'topPagination', 'tubepressBaseUrl', 'video', 'videoArray', 'videoId')
);
foreach ($toTest as $className => $expected) {
$this->assertClassHasConstants($className, $expected);
}
}
private function assertArrayEquality($expected, $actual)
{
foreach ($expected as $expectedName) {
$this->assertTrue(in_array($expectedName, $actual), "Missing expected array value: $expectedName");
}
foreach ($actual as $actualName) {
$this->assertTrue(in_array($actualName, $expected), "Extra array value: $actualName");
}
}
private function assertClassHasConstants($className, array $expected)
{
$actual = tubepress_impl_util_LangUtils::getDefinedConstants($className);
$this->assertArrayEquality($expected, $actual);
}
}