protected function FeedsMockingTrait::getMockFileSystem in Feeds 8.3
Mocks the file system.
Return value
\Drupal\Core\File\FileSystemInterface A mocked file system.
11 calls to FeedsMockingTrait::getMockFileSystem()
- OpmlParserTest::testEmptyFeed in tests/
src/ Unit/ Feeds/ Parser/ OpmlParserTest.php - Tests parsing an empty feed.
- OpmlParserTest::testParse in tests/
src/ Unit/ Feeds/ Parser/ OpmlParserTest.php - Tests parsing an OPML file that succeeds.
- RawFetcherResultTest::testGetFilePath in tests/
src/ Unit/ Result/ RawFetcherResultTest.php - @covers ::getFilePath
- RawFetcherResultTest::testGetRaw in tests/
src/ Unit/ Result/ RawFetcherResultTest.php - @covers ::getRaw
- SitemapParserTest::testEmptyFeed in tests/
src/ Unit/ Feeds/ Parser/ SitemapParserTest.php - Tests parsing an empty feed.
File
- tests/
src/ Traits/ FeedsMockingTrait.php, line 123
Class
- FeedsMockingTrait
- Provides methods for mocking certain Feeds classes.
Namespace
Drupal\Tests\feeds\TraitsCode
protected function getMockFileSystem() {
$definition = $this
->createMock(FileSystemInterface::class);
$definition
->expects($this
->any())
->method('tempnam')
->will($this
->returnCallback(function () {
$args = func_get_args();
$dir = $args[1];
mkdir('vfs://feeds/' . $dir);
$file = 'vfs://feeds/' . $dir . '/' . mt_rand(10, 1000);
touch($file);
return $file;
}));
return $definition;
}