Skip to content

Commit 0910a9c

Browse files
author
Robin Chalas
committed
Merge branch '3.4'
* 3.4: [PhpUnitBridge] Added a CoverageListener to enhance the code coverage report Add a method to check if any results were found [SecurityBundle] Deprecate ACL related code [FrameworkBundle] Enable assets with templates only if the Asset component is installed
2 parents afb5b3c + 1ca2fed commit 0910a9c

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ CHANGELOG
1111
-----
1212

1313
* deprecated `Symfony\Component\Finder\Iterator\FilterIterator`
14+
* added Finder::hasResults() method to check if any results were found
1415

1516
3.3.0
1617
-----

Finder.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,20 @@ public function append($iterator)
613613
return $this;
614614
}
615615

616+
/**
617+
* Check if the any results were found.
618+
*
619+
* @return bool
620+
*/
621+
public function hasResults()
622+
{
623+
foreach ($this->getIterator() as $_) {
624+
return true;
625+
}
626+
627+
return false;
628+
}
629+
616630
/**
617631
* Counts all the results collected by the iterators.
618632
*

Tests/FinderTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,20 @@ public function testCountWithoutIn()
424424
count($finder);
425425
}
426426

427+
public function testHasResults()
428+
{
429+
$finder = $this->buildFinder();
430+
$finder->in(__DIR__);
431+
$this->assertTrue($finder->hasResults());
432+
}
433+
434+
public function testNoResults()
435+
{
436+
$finder = $this->buildFinder();
437+
$finder->in(__DIR__)->name('DoesNotExist');
438+
$this->assertFalse($finder->hasResults());
439+
}
440+
427441
/**
428442
* @dataProvider getContainsTestData
429443
*/

0 commit comments

Comments
 (0)