Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4f9a411

Browse files
committed
minor #15808 Improve the structure of the Finder testsuite (stof)
This PR was merged into the 2.3 branch. Discussion ---------- Improve the structure of the Finder testsuite | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Testing against different adapters is now handled by multiple subclasses of a common test case rather than using data providers. This allows tests to be marked as skipped for unsupported adapters instead of making them disappear from the testsuite. This will also make it much easier to mark tests for the find-based adapters as legacy ones when deprecating them. This correspond to changes done by @nicolas-grekas in #15805, backported to 2.3 and with the data providers removed (his PR was keeping data providers for the adapter but making it return a single adapter all the time, hence the much bigger diff in my PR). All tests in AbstractFinderTest are just moved from the FinderTest (they are all the tests running against multiple adapters). FinderTest itself runs the PhpAdapter (as this is the logic we want to keep in the finder in 3.0). I also tried to have a PhpFinderTest and keeping FinderTest only with the extra tests, but this would make things harder to merge branches between 2.8 and 3.0 in the future (once we remove other adapter tests) as we could simply keep the AbstractFinderTest in 3.0 for now to ease merging PRs adding new tests for bug fixes. Commits ------- 20f2d03 Improve the structure of the Finder testsuite
2 parents 150bcc9 + 20f2d03 commit 4f9a411

File tree

4 files changed

+220
-286
lines changed

4 files changed

+220
-286
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Finder\Tests;
13+
14+
use Symfony\Component\Finder\Adapter\BsdFindAdapter;
15+
16+
class BsdFinderTest extends FinderTest
17+
{
18+
protected function getAdapter()
19+
{
20+
$adapter = new BsdFindAdapter();
21+
22+
if (!$adapter->isSupported()) {
23+
$this->markTestSkipped(get_class($adapter).' is not supported.');
24+
}
25+
26+
return $adapter;
27+
}
28+
}

0 commit comments

Comments
 (0)