public function setUp() { parent::setUp(); $this->feedType = $this->getMock('Drupal\\feeds\\FeedTypeInterface'); $method = $this->getMethod('Drupal\\feeds\\Feeds\\Target\\File', 'prepareTarget')->getClosure(); $this->targetDefinition = $method($this->getMockFieldDefinition()); }
public function setUp() { parent::setUp(); $method = $this->getMethod('Drupal\\feeds\\Feeds\\Target\\Text', 'prepareTarget')->getClosure(); $configuration = ['feed_type' => $this->getMock('Drupal\\feeds\\FeedTypeInterface'), 'target_definition' => $method($this->getMockFieldDefinition())]; $this->target = new Text($configuration, 'text', [], $this->getMock('Drupal\\Core\\Session\\AccountInterface')); $this->target->setStringTranslation($this->getStringTranslationStub()); }
public function setUp() { parent::setUp(); $this->dispatcher = new EventDispatcher(); $this->handler = new FeedImportHandler($this->dispatcher); $this->handler->setStringTranslation($this->getStringTranslationStub()); $this->feed = $this->getMock('Drupal\\feeds\\FeedInterface'); $this->feed->expects($this->any())->method('id')->will($this->returnValue(10)); $this->feed->expects($this->any())->method('bundle')->will($this->returnValue('test_feed')); }
public function setUp() { parent::setUp(); $this->entityType = $this->getMock('\\Drupal\\Core\\Entity\\EntityTypeInterface'); $this->entityType->expects($this->once())->method('id')->will($this->returnValue('feeds_feed')); $this->controller = new FeedAccessControlHandler($this->entityType); $this->moduleHandler = $this->getMock('\\Drupal\\Core\\Extension\\ModuleHandlerInterface'); $this->moduleHandler->expects($this->any())->method('invokeAll')->will($this->returnValue([])); $this->controller->setModuleHandler($this->moduleHandler); }
public function setUp() { parent::setUp(); $feed_type = $this->getMock('Drupal\\feeds\\FeedTypeInterface'); $this->client = new Client(); $this->cache = $this->getMock('Drupal\\Core\\Cache\\CacheBackendInterface'); $this->fetcher = new HttpFetcher(['feed_type' => $feed_type], 'http', [], $this->client, $this->cache); $this->fetcher->setStringTranslation($this->getStringTranslationStub()); $this->state = $this->getMock('Drupal\\feeds\\StateInterface'); }
public function setUp() { parent::setUp(); $this->fileStorage = $this->getMock('Drupal\\Core\\Entity\\EntityStorageInterface'); $entity_manager = $this->getMock('Drupal\\Core\\Entity\\EntityManagerInterface'); $entity_manager->expects($this->once())->method('getStorage')->with('file')->will($this->returnValue($this->fileStorage)); $this->fetcher = new UploadFetcher(['feed_type' => $this->getMock('Drupal\\feeds\\FeedTypeInterface')], 'test_plugin', ['plugin_type' => 'fetcher'], $this->getMock('Drupal\\file\\FileUsage\\FileUsageInterface'), $entity_manager, $this->getMock('Drupal\\Component\\Uuid\\UuidInterface'), $this->getMockStreamWrapperManager()); $this->fetcher->setStringTranslation($this->getStringTranslationStub()); $this->state = $this->getMock('Drupal\\feeds\\StateInterface'); }
public function setUp() { parent::setUp(); $this->feedType = $this->getMock('Drupal\\feeds\\FeedTypeInterface'); $configuration = ['feed_type' => $this->feedType]; $this->parser = new SitemapParser($configuration, 'sitemap', []); $this->parser->setStringTranslation($this->getStringTranslationStub()); $this->state = new State(); $this->feed = $this->getMock('Drupal\\feeds\\FeedInterface'); $this->feed->expects($this->any())->method('getType')->will($this->returnValue($this->feedType)); }
public function setUp() { parent::setUp(); $this->dispatcher = new EventDispatcher(); $this->context = []; $this->handler = new FeedClearHandler($this->dispatcher); $this->handler->setStringTranslation($this->getStringTranslationStub()); $state = new State(); $this->feed = $this->getMock('Drupal\\feeds\\FeedInterface'); $this->feed->expects($this->any())->method('getState')->with(StateInterface::CLEAR)->will($this->returnValue($state)); }
public function setUp() { parent::setUp(); $container = new ContainerBuilder(); $this->dispatcher = new EventDispatcher(); $queue_factory = $this->getMock('Drupal\\Core\\Queue\\QueueFactory', [], [], '', FALSE); $queue_factory->expects($this->any())->method('get')->with('feeds_feed_process:')->will($this->returnValue($this->getMock('Drupal\\Core\\Queue\\QueueInterface'))); $container->set('queue', $queue_factory); $container->set('event_dispatcher', $this->dispatcher); $this->plugin = FeedParse::create($container, [], 'feeds_feed_parse', []); $this->feed = $this->getMockFeed(); }
public function setUp() { parent::setUp(); $container = new ContainerBuilder(); $language_manager = $this->getMock('Drupal\\Core\\Language\\LanguageManagerInterface'); $language = $this->getMock('Drupal\\Core\\Language\\LanguageInterface'); $language->expects($this->any())->method('getId')->will($this->returnValue('en')); $language_manager->expects($this->any())->method('getCurrentLanguage')->will($this->returnValue($language)); $container->set('language_manager', $language_manager); \Drupal::setContainer($container); $this->feedType = $this->getMock('Drupal\\feeds\\FeedTypeInterface'); $method = $this->getMethod('Drupal\\feeds\\Feeds\\Target\\DateTime', 'prepareTarget')->getClosure(); $this->targetDefinition = $method($this->getMockFieldDefinition(['datetime_type' => 'time'])); }
public function setUp() { parent::setUp(); $this->dispatcher = new EventDispatcher(); // Dispatcher used to verify things only get called once. $this->explodingDispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'); $this->explodingDispatcher->expects($this->any())->method('addListener')->will($this->throwException(new \Exception())); $this->state = $this->getMock('Drupal\\feeds\\StateInterface'); $this->feed = $this->getMock('Drupal\\feeds\\FeedInterface'); $this->feed->expects($this->any())->method('getState')->will($this->returnValue($this->state)); $this->feedType = $this->getMock('Drupal\\feeds\\FeedTypeInterface'); $this->fetcher = $this->getMock('Drupal\\feeds\\Plugin\\Type\\Fetcher\\FetcherInterface'); $this->parser = $this->getMock('Drupal\\feeds\\Plugin\\Type\\Parser\\ParserInterface'); $this->processor = $this->getMock('Drupal\\feeds\\Plugin\\Type\\Processor\\ProcessorInterface'); $this->feed->expects($this->any())->method('getType')->will($this->returnValue($this->feedType)); }
public function setUp() { parent::setUp(); $container = new ContainerBuilder(); $manager = new ZfExtensionManagerSfContainer('feed.reader.'); foreach ($this->readerExtensions as $key => $class) { $container->set($key, new $class()); } $manager->setContainer($container); $container->set('feed.bridge.reader', $manager); \Drupal::setContainer($container); $this->feedType = $this->getMock('Drupal\\feeds\\FeedTypeInterface'); $configuration = ['feed_type' => $this->feedType]; $this->parser = new SyndicationParser($configuration, 'syndication', []); $this->parser->setStringTranslation($this->getStringTranslationStub()); $this->state = new State(); $this->feed = $this->getMock('Drupal\\feeds\\FeedInterface'); $this->feed->expects($this->any())->method('getType')->will($this->returnValue($this->feedType)); }
public function setUp() { parent::setUp(); $feed_type = $this->getMock('Drupal\\feeds\\FeedTypeInterface'); $container = new ContainerBuilder(); $container->set('stream_wrapper_manager', $this->getMockStreamWrapperManager()); $this->fetcher = new DirectoryFetcher(['feed_type' => $feed_type], 'directory', []); $this->fetcher->setStringTranslation($this->getStringTranslationStub()); $this->state = new State(); $this->feed = $this->getMock('Drupal\\feeds\\FeedInterface'); $this->feed->expects($this->any())->method('getSource')->will($this->returnValue('vfs://feeds')); // Prepare filesystem. touch('vfs://feeds/test_file_1.txt'); touch('vfs://feeds/test_file_2.txt'); touch('vfs://feeds/test_file_3.txt'); touch('vfs://feeds/test_file_3.mp3'); chmod('vfs://feeds/test_file_3.txt', 0333); mkdir('vfs://feeds/subdir'); touch('vfs://feeds/subdir/test_file_4.txt'); touch('vfs://feeds/subdir/test_file_4.mp3'); }
public function setUp() { parent::setUp(); $this->dispatcher = new EventDispatcher(); $this->feed = $this->getMock('Drupal\\feeds\\FeedInterface'); }