/**
  * Ooyala has to be loaded before providers which load their content onto Ooyala (aka, remote assets),
  * otherwise videos can be uploaded more than once.
  * See VID-1871 for more information.
  */
 public function testOoyalaLoadedBeforeRemoteAssets()
 {
     $providers = FeedIngesterFactory::getActiveProviders();
     $ooyalaIndex = array_search(FeedIngesterFactory::PROVIDER_OOYALA, $providers);
     $screenplayIndex = array_search(FeedIngesterFactory::PROVIDER_SCREENPLAY, $providers);
     $ivaIndex = array_search(FeedIngesterFactory::PROVIDER_IVA, $providers);
     $this->assertTrue($ooyalaIndex < $screenplayIndex, 'Ooyala should be loaded before screenplay');
     $this->assertTrue($ooyalaIndex < $ivaIndex, 'Ooyala should be loaded before iva');
 }
// include cldr extension for language code ($languageNames), country code ($countryNames)
include dirname(__FILE__) . '/../../../extensions/cldr/CldrNames/CldrNamesEn.php';
$extraCond[] = "created_at < '2013-08-29T00:00:00Z'";
if (!empty($videoTitle)) {
    $extraCond[] = "name='{$videoTitle}'";
}
if ($iva) {
    $provider = 'iva';
    $isRemoteAsset = true;
    $extraCond[] = "asset_type='remote_asset'";
} else {
    $provider = 'ooyala';
    $isRemoteAsset = false;
    $extraCond[] = "asset_type!='remote_asset'";
}
$ingester = FeedIngesterFactory::getIngester($provider);
// get WikiFactory data
$ingestionData = $ingester->getWikiIngestionData();
if (empty($ingestionData)) {
    die("No ingestion data found in wikicities. Aborting.\n");
}
// keywords for page categories
$categories = array('International', 'Foreign', 'Movies', 'TV', 'Gaming', 'Games', 'Others', 'Entertainment', 'Trailers', 'Webinars', 'Support', 'Community', 'Clips', 'Anime', 'Gameplay', 'Books', 'Trailer', 'Television', 'Interviews', 'SciFi', 'Featurettes', 'Featurette', 'Community Support', 'How-to', 'How To', 'Intro', 'Comedy', 'Animation', 'Overhaul', 'Wikia Webinars', 'Epic', 'SOE', 'EA', 'Konami', 'ubisoft', 'WBIE', 'Comics', 'Comic-Con', 'Food', 'Walkthroughs', 'Walkthrough', 'Remake', 'Expert Showcase', 'Wikia Productions', 'Adventure', 'Pixar', 'Disney', 'RPG', 'Namco Bandai', 'Cartoon', 'Wikia Fan Media', 'Action', 'Multiplayer', 'Online', 'Marvel', 'Walt Disney', 'Shooter', 'Horror', 'Drama');
$nextPage = '';
$page = 1;
$total = 0;
$failed = 0;
$skipped = 0;
do {
    // connect to provider API
    $url = OoyalaAsset::getApiUrlAssets($apiPageSize, $nextPage, $extraCond);
function loadProviders($provider)
{
    if (empty($provider)) {
        // If no provider was specified, assume all active providers
        $providersVideoFeed = FeedIngesterFactory::getActiveProviders();
    } elseif (array_search($provider, FeedIngesterFactory::getAllProviders()) !== false) {
        // If a provider was specified, check it against the list of legal providers
        $providersVideoFeed = [$provider];
    } else {
        // If a provider was given but was not found, die.
        die("unknown provider {$provider}. aborting.\n");
    }
    return $providersVideoFeed;
}