function setup()
 {
     parent::setUp();
     $this->_sut = $this->buildSut();
     $this->_response = \Mockery::mock(org_tubepress_api_http_HttpResponse::_);
     $this->_entity = \Mockery::mock(org_tubepress_api_http_HttpEntity::_);
 }
Пример #2
0
 function setup()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_provider_SimpleProvider();
     $this->_fakeVideo = \Mockery::mock('org_tubepress_api_video_Video');
     org_tubepress_impl_log_Log::setEnabled(false, array());
 }
Пример #3
0
 function setUp()
 {
     parent::setUp();
     $this->tearDown();
     $this->_sut = new org_tubepress_impl_filesystem_FsExplorer();
     @mkdir('/tmp/tubepress-fs-test');
 }
 function setup()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_http_transferencoding_ChunkedTransferDecoder();
     $this->_response = \Mockery::mock(org_tubepress_api_http_HttpResponse::_);
     $this->_entity = \Mockery::mock(org_tubepress_api_http_HttpEntity::_);
 }
 function setUp()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_cache_PearCacheLiteCacheService();
     $this->_tempPath = dirname(__FILE__) . '/tmp';
     mkdir($this->_tempPath);
 }
 function setup()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_http_HttpResponseHandlerChain();
     $this->_response = \Mockery::mock(org_tubepress_api_http_HttpResponse::_);
     $this->_entity = \Mockery::mock(org_tubepress_api_http_HttpEntity::_);
 }
 function setUp()
 {
     parent::setUp();
     $this->_sut = $this->_getSutInstance();
     org_tubepress_impl_log_Log::setEnabled(true, array('tubepress_debug' => 'true'));
     $this->_server = 'http://tubepress.org/http_tests';
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $mp = $ioc->get(org_tubepress_spi_http_HttpMessageParser::_);
     $mp->shouldReceive('getHeadersStringFromRawHttpMessage')->andReturnUsing(function ($data) {
         $x = new org_tubepress_impl_http_DefaultHttpMessageParser();
         return $x->getHeadersStringFromRawHttpMessage($data);
     });
     $mp->shouldReceive('getBodyStringFromRawHttpMessage')->andReturnUsing(function ($data) {
         $x = new org_tubepress_impl_http_DefaultHttpMessageParser();
         return $x->getBodyStringFromRawHttpMessage($data);
     });
     $mp->shouldReceive('getArrayOfHeadersFromRawHeaderString')->andReturnUsing(function ($data) {
         $x = new org_tubepress_impl_http_DefaultHttpMessageParser();
         return $x->getArrayOfHeadersFromRawHeaderString($data);
     });
     $mp->shouldReceive('getHeaderArrayAsString')->andReturnUsing(function ($data) {
         $x = new org_tubepress_impl_http_DefaultHttpMessageParser();
         return $x->getHeaderArrayAsString($data);
     });
 }
Пример #8
0
 function testConstants()
 {
     $toTest = array('org_tubepress_api_const_http_ParamName' => array('tubepress_debug', 'tubepress_page', 'tubepress_search', 'tubepress_shortcode', 'tubepress_video'), 'org_tubepress_api_const_options_names_Advanced' => array('debugging_enabled', 'disableHttpTransportCurl', 'disableHttpTransportExtHttp', 'disableHttpTransportFopen', 'disableHttpTransportFsockOpen', 'disableHttpTransportStreams', 'keyword', 'galleryId', 'https'), 'org_tubepress_api_const_options_names_Cache' => array('cacheEnabled', 'cacheCleaningFactor', 'cacheDirectory', 'cacheLifetimeSeconds'), 'org_tubepress_api_const_options_names_Embedded' => array('playerImplementation', 'embeddedHeight', 'embeddedWidth', 'lazyPlay', 'autoplay', 'fullscreen', 'hd', 'loop', 'playerColor', 'playerHighlight', 'showInfo', 'showRelated', 'playerLocation', 'autoNext', 'sequence', 'enableJsApi', 'autoHide', 'modestBranding'), 'org_tubepress_api_const_options_names_Feed' => array('orderBy', 'videoBlacklist', 'developerKey', 'embeddableOnly', 'filter_racy', 'resultCountCap', 'searchResultsRestrictedToUser', 'vimeoKey', 'vimeoSecret', 'perPageSort'), 'org_tubepress_api_const_options_names_GallerySource' => array('favoritesValue', 'most_viewedValue', 'playlistValue', 'tagValue', 'youtubeTopFavoritesValue', 'top_ratedValue', 'userValue', 'vimeoAlbumValue', 'vimeoAppearsInValue', 'vimeoChannelValue', 'vimeoCreditedToValue', 'vimeoGroupValue', 'vimeoLikesValue', 'vimeoSearchValue', 'vimeoUploadedByValue', 'most_discussedValue', 'most_recentValue', 'most_respondedValue', 'recently_featured'), 'org_tubepress_api_const_options_names_InteractiveSearch' => array('searchProvider', 'searchResultsDomId', 'searchResultsOnly', 'searchResultsUrl'), 'org_tubepress_api_const_options_names_Meta' => array('author', 'category', 'description', 'id', 'length', 'likes', 'rating', 'ratings', 'tags', 'title', 'uploaded', 'url', 'views', 'dateFormat', 'descriptionLimit', 'relativeDates'), 'org_tubepress_api_const_options_names_Output' => array('mode', 'output', 'video'), 'org_tubepress_api_const_options_names_Thumbs' => array('theme', 'ajaxPagination', 'resultsPerPage', 'hqThumbs', 'thumbHeight', 'thumbWidth', 'fluidThumbs', 'paginationAbove', 'paginationBelow', 'randomize_thumbnails'), 'org_tubepress_api_const_options_names_WordPress' => array('widget-tagstring', 'widget-title', 'showVimeoOptions', 'showYouTubeOptions'), 'org_tubepress_api_const_options_values_GallerySourceValue' => array('favorites', 'most_discussed', 'most_recent', 'most_responded', 'most_viewed', 'playlist', 'recently_featured', 'tag', 'top_rated', 'user', 'vimeoAlbum', 'vimeoAppearsIn', 'vimeoChannel', 'vimeoCreditedTo', 'vimeoGroup', 'vimeoLikes', 'vimeoSearch', 'vimeoUploadedBy', 'youtubeTopFavorites'), 'org_tubepress_api_const_options_values_OrderByValue' => array('commentCount', 'duration', 'newest', 'oldest', 'position', 'random', 'rating', 'relevance', 'title', 'viewCount'), 'org_tubepress_api_const_options_values_OutputValue' => array('ajaxSearchInput', 'searchInput', 'searchResults', 'player'), 'org_tubepress_api_const_options_values_PerPageSortValue' => array('commentCount', 'duration', 'newest', 'oldest', 'random', 'rating', 'none', 'title', 'viewCount'), 'org_tubepress_api_const_options_values_PlayerImplementationValue' => array('embedplus', 'longtail', 'provider_based'), 'org_tubepress_api_const_options_values_PlayerLocationValue' => array('fancybox', 'jqmodal', 'normal', 'popup', 'shadowbox', 'solo', 'static', 'tinybox', 'vimeo', 'youtube', 'detached'), 'org_tubepress_api_const_options_values_SafeSearchValue' => array('moderate', 'none', 'strict'), 'org_tubepress_api_const_options_values_TimeFrameValue' => array('all_time', 'this_month', 'this_week', 'today'), 'org_tubepress_api_const_plugin_EventName' => array('boot'), 'org_tubepress_api_const_plugin_FilterPoint' => array('embeddedHtml', 'embeddedTemplate', 'galleryHtml', 'galleryTemplate', 'html', 'galleryInitJavaScript', 'paginationHtml', 'playerHtml', 'playerTemplate', 'providerResult', 'searchInputHtml', 'searchInputTemplate', 'singleVideoHtml', 'singleVideoTemplate', 'video', 'preValidationOptionSet', 'variableReadFromExternalInput'), 'org_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', 'shortcode'));
     foreach ($toTest as $className => $expected) {
         TubePressUnitTest::assertClassHasConstants($className, $expected);
     }
 }
 public function setup()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_exec_MemoryExecutionContext();
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $this->_validationService = $ioc->get(org_tubepress_api_options_OptionValidator::_);
     $this->_pluginManager = $ioc->get(org_tubepress_api_plugin_PluginManager::_);
 }
 function setup()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_shortcode_SimpleShortcodeParser();
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $context = $ioc->get(org_tubepress_api_exec_ExecutionContext::_);
     $context->shouldReceive('get')->once()->with(org_tubepress_api_const_options_names_Advanced::KEYWORD)->andReturn('butters');
 }
 function setup()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_plugin_listeners_SkeletonExistsListener();
     if (!defined('ABSPATH')) {
         define('ABSPATH', '/value-of-abspath/');
     }
 }
 function setUp()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_player_DefaultPlayerHtmlGenerator();
     org_tubepress_impl_log_Log::setEnabled(false, array());
     $this->_video = \Mockery::mock('org_tubepress_api_video_Video');
     $this->_video->shouldReceive('getId')->once()->andReturn('video-id');
 }
 function setUp()
 {
     parent::setUp();
     $this->_sut = $this->buildSut();
     $this->_response = \Mockery::mock(org_tubepress_api_http_HttpResponse::_);
     $this->_context = new stdClass();
     $this->_context->response = $this->_response;
 }
 function setup()
 {
     $this->_page = 1;
     parent::setUp();
     $this->_sut = new org_tubepress_impl_shortcode_ShortcodeHtmlGeneratorChain();
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $shortcodeParser = $ioc->get(org_tubepress_api_shortcode_ShortcodeParser::_);
     $shortcodeParser->shouldReceive('parse')->once()->with('shortcode');
 }
Пример #15
0
 public function setup()
 {
     parent::setUp();
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $this->_messageService = $ioc->get(org_tubepress_api_message_MessageService::_);
     $this->_messageService->shouldReceive('_')->andReturnUsing(function ($key) {
         return "<<message: {$key}>>";
     });
 }
 function setUp()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_ioc_FreeWordPressPluginIocService();
     if (!self::$_booted) {
         self::$_booted = true;
         $this->_setupEveryInterfaceIsBound();
     }
     $this->_expectedMapping = array('org_tubepress_api_bootstrap_Bootstrapper' => 'org_tubepress_impl_bootstrap_TubePressBootstrapper', 'org_tubepress_api_cache_Cache' => 'org_tubepress_impl_cache_PearCacheLiteCacheService', 'org_tubepress_api_embedded_EmbeddedHtmlGenerator' => 'org_tubepress_impl_embedded_EmbeddedPlayerChain', 'org_tubepress_api_environment_Detector' => 'org_tubepress_impl_environment_SimpleEnvironmentDetector', 'org_tubepress_api_factory_VideoFactory' => 'org_tubepress_impl_factory_VideoFactoryChain', 'org_tubepress_api_feed_FeedFetcher' => 'org_tubepress_impl_feed_CacheAwareFeedFetcher', 'org_tubepress_api_feed_FeedInspector' => 'org_tubepress_impl_feed_FeedInspectorChain', 'org_tubepress_api_filesystem_Explorer' => 'org_tubepress_impl_filesystem_FsExplorer', 'org_tubepress_api_html_HeadHtmlGenerator' => 'org_tubepress_impl_html_DefaultHeadHtmlGenerator', 'org_tubepress_api_http_HttpClient' => 'org_tubepress_impl_http_HttpClientChain', 'org_tubepress_api_http_HttpRequestParameterService' => 'org_tubepress_impl_http_DefaultHttpRequestParameterService', 'org_tubepress_api_message_MessageService' => 'org_tubepress_impl_message_WordPressMessageService', 'org_tubepress_api_exec_ExecutionContext' => 'org_tubepress_impl_exec_MemoryExecutionContext', 'org_tubepress_api_options_OptionValidator' => 'org_tubepress_impl_options_SimpleOptionValidator', 'org_tubepress_api_options_StorageManager' => 'org_tubepress_impl_options_WordPressStorageManager', 'org_tubepress_api_plugin_PluginManager' => 'org_tubepress_impl_plugin_PluginManagerImpl', 'org_tubepress_spi_patterns_cor_Chain' => 'org_tubepress_impl_patterns_cor_ChainGang', 'org_tubepress_api_player_PlayerHtmlGenerator' => 'org_tubepress_impl_player_DefaultPlayerHtmlGenerator', 'org_tubepress_api_provider_Provider' => 'org_tubepress_impl_provider_SimpleProvider', 'org_tubepress_api_provider_ProviderCalculator' => 'org_tubepress_impl_provider_SimpleProviderCalculator', 'org_tubepress_api_querystring_QueryStringService' => 'org_tubepress_impl_querystring_SimpleQueryStringService', 'org_tubepress_api_shortcode_ShortcodeHtmlGenerator' => 'org_tubepress_impl_shortcode_ShortcodeHtmlGeneratorChain', 'org_tubepress_api_shortcode_ShortcodeParser' => 'org_tubepress_impl_shortcode_SimpleShortcodeParser', 'org_tubepress_api_template_TemplateBuilder' => 'org_tubepress_impl_template_SimpleTemplateBuilder', 'org_tubepress_api_theme_ThemeHandler' => 'org_tubepress_impl_theme_SimpleThemeHandler', 'org_tubepress_api_feed_UrlBuilder' => 'org_tubepress_impl_feed_UrlBuilderChain');
 }
 function setUp()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_feed_urlbuilding_VimeoUrlBuilderCommand();
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $pc = $ioc->get(org_tubepress_api_provider_ProviderCalculator::_);
     $pc->shouldReceive('calculateProviderOfVideoId')->zeroOrMoreTimes()->andReturn(org_tubepress_api_provider_Provider::VIMEO);
     $execContext = $ioc->get(org_tubepress_api_exec_ExecutionContext::_);
     $execContext->shouldReceive('get')->zeroOrMoreTimes()->with(org_tubepress_api_const_options_names_Thumbs::RESULTS_PER_PAGE)->andReturn(20);
 }
Пример #18
0
 function setUp()
 {
     parent::setUp();
     $this->_sut = new FakeHttpTransport();
     $this->_context = new stdClass();
     $this->_request = \Mockery::mock(org_tubepress_api_http_HttpRequest::_);
     $this->_request->shouldReceive('__toString')->andReturn('request as string');
     $this->_context->request = $this->_request;
     ob_start();
 }
Пример #19
0
 public function setup()
 {
     parent::setUp();
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $ms = $ioc->get(org_tubepress_api_message_MessageService::_);
     $ms->shouldReceive('_')->andReturnUsing(function ($key) {
         return "<<message: {$key}>>";
     });
     $this->_sut = new org_tubepress_impl_options_ui_tabs_GallerySourceTab();
 }
Пример #20
0
 function setup()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_http_HttpClientChain();
     $this->_request = \Mockery::mock(org_tubepress_api_http_HttpRequest::_);
     $this->_response = new org_tubepress_api_http_HttpResponse();
     $this->_url = \Mockery::mock(org_tubepress_api_url_Url::_);
     $this->_context = new stdClass();
     $this->_actualCommands = array('org_tubepress_impl_http_transports_ExtHttpTransport', 'org_tubepress_impl_http_transports_CurlTransport', 'org_tubepress_impl_http_transports_StreamsTransport', 'org_tubepress_impl_http_transports_FsockOpenTransport');
     $this->_chain = null;
 }
 public function setup()
 {
     parent::setUp();
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $themeHandler = $ioc->get(org_tubepress_api_theme_ThemeHandler::_);
     $explorer = $ioc->get(org_tubepress_api_filesystem_Explorer::_);
     $themeHandler->shouldReceive('getUserContentDirectory')->once()->andReturn('user-content-dir');
     $explorer->shouldReceive('getTubePressBaseInstallationPath')->once()->andReturn('base-install-path');
     $explorer->shouldReceive('getDirectoriesInDirectory')->once()->with('base-install-path/sys/ui/themes', 'Default Option Descriptor Reference')->andReturn(array('boo'));
     $explorer->shouldReceive('getDirectoriesInDirectory')->once()->with('user-content-dir/themes', 'Default Option Descriptor Reference')->andReturn(array('bob'));
     $this->_sut = new org_tubepress_impl_options_DefaultOptionDescriptorReference();
 }
 function setUp()
 {
     parent::setUp();
     $get_option = new PHPUnit_Extensions_MockFunction('get_option');
     $get_option->expects($this->any())->will($this->returnCallback(array($this, 'callback')));
     $update_option = new PHPUnit_Extensions_MockFunction('update_option');
     $this->setupInit();
     $this->_sut = new org_tubepress_impl_options_WordPressStorageManager();
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $validator = $ioc->get(org_tubepress_api_options_OptionValidator::_);
     $validator->shouldReceive('isValid')->andReturn(true);
     $this->_sut->init();
 }
 function setUp()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_feed_urlbuilding_YouTubeUrlBuilderCommand();
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $pc = $ioc->get(org_tubepress_api_provider_ProviderCalculator::_);
     $pc->shouldReceive('calculateProviderOfVideoId')->zeroOrMoreTimes()->andReturn(org_tubepress_api_provider_Provider::YOUTUBE);
     $execContext = $ioc->get(org_tubepress_api_exec_ExecutionContext::_);
     $execContext->shouldReceive('get')->zeroOrMoreTimes()->with(org_tubepress_api_const_options_names_Thumbs::RESULTS_PER_PAGE)->andReturn(20);
     $execContext->shouldReceive('get')->zeroOrMoreTimes()->with(org_tubepress_api_const_options_names_Feed::ORDER_BY)->andReturn('viewCount');
     $execContext->shouldReceive('get')->zeroOrMoreTimes()->with(org_tubepress_api_const_options_names_Feed::FILTER)->andReturn('moderate');
     $execContext->shouldReceive('get')->zeroOrMoreTimes()->with(org_tubepress_api_const_options_names_Feed::EMBEDDABLE_ONLY)->andReturn(true);
     $execContext->shouldReceive('get')->zeroOrMoreTimes()->with(org_tubepress_api_const_options_names_Feed::DEV_KEY)->andReturn('AI39si5uUzupiQW9bpzGqZRrhvqF3vBgRqL-I_28G1zWozmdNJlskzMDQEhpZ-l2RqGf_6CNWooL96oJZRrqKo-eJ9QO_QppMg');
 }
 public function setup()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_options_ui_DefaultTabsHandler();
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $gal = $ioc->get(org_tubepress_impl_options_ui_tabs_GallerySourceTab::_);
     $tab = $ioc->get('org_tubepress_impl_options_ui_tabs_ThumbsTab');
     $emb = $ioc->get(org_tubepress_impl_options_ui_tabs_EmbeddedTab::_);
     $met = $ioc->get(org_tubepress_impl_options_ui_tabs_MetaTab::_);
     $thm = $ioc->get(org_tubepress_impl_options_ui_tabs_ThemeTab::_);
     $fee = $ioc->get(org_tubepress_impl_options_ui_tabs_FeedTab::_);
     $cah = $ioc->get(org_tubepress_impl_options_ui_tabs_CacheTab::_);
     $adv = $ioc->get('org_tubepress_impl_options_ui_tabs_AdvancedTab');
     $this->_expectedTabs = array($gal, $tab, $adv, $cah, $emb, $thm, $fee, $met);
 }
Пример #25
0
 public function setup()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_plugin_filters_gallerytemplate_Pagination();
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $this->_hrps = $ioc->get(org_tubepress_api_http_HttpRequestParameterService::_);
     $this->_execContext = $ioc->get(org_tubepress_api_exec_ExecutionContext::_);
     $this->_execContext->shouldReceive('get')->once()->with(org_tubepress_api_const_options_names_Thumbs::PAGINATE_ABOVE)->andReturn(true);
     $this->_execContext->shouldReceive('get')->once()->with(org_tubepress_api_const_options_names_Thumbs::PAGINATE_BELOW)->andReturn(true);
     $this->_execContext->shouldReceive('get')->once()->with(org_tubepress_api_const_options_names_Thumbs::RESULTS_PER_PAGE)->andReturn(4);
     $this->_providerResult = \Mockery::mock('org_tubepress_api_provider_ProviderResult');
     $this->_providerResult->shouldReceive('getEffectiveTotalResultCount')->once()->andReturn(500);
     $this->_mockTemplate = \Mockery::mock('org_tubepress_api_template_Template');
     $this->_mockTemplate->shouldReceive('setVariable')->once()->with(org_tubepress_api_const_template_Variable::PAGINATION_TOP, 'pagination-html');
     $this->_mockTemplate->shouldReceive('setVariable')->once()->with(org_tubepress_api_const_template_Variable::PAGINATION_BOTTOM, 'pagination-html');
     $this->_qss = $ioc->get(org_tubepress_api_querystring_QueryStringService::_);
     $this->_qss->shouldReceive('getFullUrl')->once()->andReturn('http://tubepress.org');
     $messageService = $ioc->get(org_tubepress_api_message_MessageService::_);
     $messageService->shouldReceive('_')->atLeast()->once()->andReturnUsing(function ($msg) {
         return "##{$msg}##";
     });
     $this->_pluginManager = $ioc->get(org_tubepress_api_plugin_PluginManager::_);
 }
 function setUp()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_environment_SimpleEnvironmentDetector();
 }
 function setUp()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_feed_CacheAwareFeedFetcher();
     org_tubepress_impl_log_Log::setEnabled(false, array());
 }
 function setUp()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_factory_commands_VimeoFactoryCommand();
     $this->_multipleFeed = file_get_contents(dirname(__FILE__) . '/../feeds/vimeo.txt');
 }
Пример #29
0
 function setup()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_plugin_filters_providerresult_PerPageSorter();
     $this->_buildVideos();
 }
 function setup()
 {
     parent::setUp();
     $this->_sut = new org_tubepress_impl_plugin_filters_galleryinitjs_GalleryInitJsBaseParams();
 }