当前位置: 首页>>代码示例>>PHP>>正文


PHP SplFileInfo::getWrappedObject方法代码示例

本文整理汇总了PHP中Symfony\Component\Finder\SplFileInfo::getWrappedObject方法的典型用法代码示例。如果您正苦于以下问题:PHP SplFileInfo::getWrappedObject方法的具体用法?PHP SplFileInfo::getWrappedObject怎么用?PHP SplFileInfo::getWrappedObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Finder\SplFileInfo的用法示例。


在下文中一共展示了SplFileInfo::getWrappedObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 function it_searches_for_files(FinderFactoryInterface $finderFactory, Finder $finder, SplFileInfo $firstSplFileInfo, SplFileInfo $secondSplFileInfo)
 {
     $finderFactory->create()->willReturn($finder);
     $finder->name('readme.md')->shouldBeCalled()->willReturn($finder);
     $finder->in(['/search/path/'])->shouldBeCalled()->willReturn($finder);
     $finder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($finder);
     $finder->files()->shouldBeCalled()->willReturn($finder);
     $finder->getIterator()->willReturn(new \ArrayIterator([$firstSplFileInfo->getWrappedObject(), $secondSplFileInfo->getWrappedObject()]));
     $finder->count()->willReturn(2);
     $firstSplFileInfo->getPathname()->willReturn('/search/path/nested1/readme.md');
     $secondSplFileInfo->getPathname()->willReturn('/search/path/nested2/readme.md');
     $this->locateFilesNamed('readme.md')->shouldReturn(['/search/path/nested1/readme.md', '/search/path/nested2/readme.md']);
 }
开发者ID:vikey89,项目名称:Sylius,代码行数:13,代码来源:RecursiveFileLocatorSpec.php

示例2:

 function it_should_filter_by_a_list_of_files(SplFileInfo $file1, SplFileInfo $file2)
 {
     $file1->getPathname()->willReturn('path1/file.php');
     $file2->getPathname()->willReturn('path2/file.php');
     $iterator = new \ArrayIterator(array($file1->getWrappedObject()));
     $result = $this->filterByFileList($iterator);
     $result->count()->shouldBe(1);
     $files = $result->toArray();
     $files[0]->shouldBe($file1);
 }
开发者ID:kientrunghuynh,项目名称:grumphp,代码行数:10,代码来源:FilesCollectionSpec.php

示例3:

 function it_silences_finder_exceptions_even_if_searching_in_multiple_sources(FinderFactoryInterface $finderFactory, Finder $firstFinder, Finder $secondFinder, SplFileInfo $splFileInfo)
 {
     $this->beConstructedWith($finderFactory, ['/search/path/first/', '/search/path/second/']);
     $finderFactory->create()->willReturn($firstFinder, $secondFinder);
     $firstFinder->name('readme.md')->shouldBeCalled()->willReturn($firstFinder);
     $firstFinder->in('/search/path/first/')->shouldBeCalled()->willReturn($firstFinder);
     $firstFinder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($firstFinder);
     $firstFinder->files()->shouldBeCalled()->willReturn($firstFinder);
     $secondFinder->name('readme.md')->shouldBeCalled()->willReturn($secondFinder);
     $secondFinder->in('/search/path/second/')->shouldBeCalled()->willReturn($secondFinder);
     $secondFinder->ignoreUnreadableDirs()->shouldBeCalled()->willReturn($secondFinder);
     $secondFinder->files()->shouldBeCalled()->willReturn($secondFinder);
     $firstFinder->getIterator()->willReturn(new \ArrayIterator([$splFileInfo->getWrappedObject()]));
     $secondFinder->getIterator()->willThrow(\InvalidArgumentException::class);
     $splFileInfo->getPathname()->willReturn('/search/path/first/nested/readme.md');
     $this->locateFilesNamed('readme.md')->shouldReturn(['/search/path/first/nested/readme.md']);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:17,代码来源:RecursiveFileLocatorSpec.php


注:本文中的Symfony\Component\Finder\SplFileInfo::getWrappedObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。