You are here

public function DirectoryFetcherTest::testFetchDir in Feeds 8.3

Tests fetching from a directory on which we don't have read permissions.

@covers ::fetch

File

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

Class

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

Namespace

Drupal\Tests\feeds\Unit\Feeds\Fetcher

Code

public function testFetchDir() {
  $result = $this->fetcher
    ->fetch($this->feed, $this->state);
  $this
    ->assertSame($this->state->total, 2);
  $this
    ->assertSame('vfs://feeds/test_file_1.txt', $result
    ->getFilePath());
  $this
    ->assertSame('vfs://feeds/test_file_2.txt', $this->fetcher
    ->fetch($this->feed, $this->state)
    ->getFilePath());
  chmod('vfs://feeds', 0333);
  $this
    ->expectException(RuntimeException::class);
  $result = $this->fetcher
    ->fetch($this->feed, $this->state);
}