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

Skip to content

Improve the structure of the Finder testsuite #15808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2015

Conversation

stof
Copy link
Member

@stof stof commented Sep 15, 2015

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.

@nicolas-grekas
Copy link
Member

I agree with you, this structure will ease with deprecating in 2.8 and removing in 3.0
What about merging AbstractFinderTest and FinderTest? we only need a protected getAdapter in FinderTest and to specialize it in Gnu/Bsd tests isn't it?

@@ -16,7 +16,7 @@
protected function assertIterator($expected, \Traversable $iterator)
{
// set iterator_to_array $use_key to false to avoid values merge
// this made FinderTest::testAppendWithAnArray() failed with GnuFinderAdapter
// this made AbstractFinderTest::testAppendWithAnArray() failed with GnuFinderAdapter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: failed vs fail

@stof
Copy link
Member Author

stof commented Sep 15, 2015

@nicolas-grekas this would run non-adapter related tests multiple times (once per adapter), making it harder to understand failures though

@nicolas-grekas
Copy link
Member

Ok, 👍 (with comment + fabbot fix)
Status: reviewed

@stof
Copy link
Member Author

stof commented Sep 15, 2015

done

@stof stof force-pushed the improve_finder_tests branch from 5ed55da to 66d91ac Compare September 15, 2015 16:38
@nicolas-grekas
Copy link
Member

Thinking twice here: if we remove completely the concept of adapters, then the tests split will create some difficulties. I'd be in favor of merging for this reason, and accept running the same tests many times...

@stof stof force-pushed the improve_finder_tests branch from 66d91ac to 97fbe90 Compare September 16, 2015 07:51
@stof
Copy link
Member Author

stof commented Sep 16, 2015

@nicolas-grekas done

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.
@stof stof force-pushed the improve_finder_tests branch from 97fbe90 to 20f2d03 Compare September 16, 2015 07:54
@fabpot
Copy link
Member

fabpot commented Sep 16, 2015

Thank you @stof.

@fabpot fabpot merged commit 20f2d03 into symfony:2.3 Sep 16, 2015
fabpot added a commit that referenced this pull request Sep 16, 2015
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
@stof stof deleted the improve_finder_tests branch September 16, 2015 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants