You are here

public function DirectoryFetcherTest::setUp in Feeds 8.3

Same name in this branch
  1. 8.3 tests/src/Unit/Feeds/Fetcher/DirectoryFetcherTest.php \Drupal\Tests\feeds\Unit\Feeds\Fetcher\DirectoryFetcherTest::setUp()
  2. 8.3 tests/src/Kernel/Feeds/Fetcher/DirectoryFetcherTest.php \Drupal\Tests\feeds\Kernel\Feeds\Fetcher\DirectoryFetcherTest::setUp()

Overrides FeedsUnitTestCase::setUp

File

tests/src/Unit/Feeds/Fetcher/DirectoryFetcherTest.php, line 42

Class

DirectoryFetcherTest
@coversDefaultClass \Drupal\feeds\Feeds\Fetcher\DirectoryFetcher @group feeds

Namespace

Drupal\Tests\feeds\Unit\Feeds\Fetcher

Code

public function setUp() {
  parent::setUp();
  $feed_type = $this
    ->createMock('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
    ->createMock('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');
}