當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。