-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Support using @depends to depend on classes #3936
Merged
sebastianbergmann
merged 28 commits into
sebastianbergmann:master
from
epdenouden:feature/issue-3519-depends-on-class
Jun 15, 2020
Merged
Support using @depends to depend on classes #3936
sebastianbergmann
merged 28 commits into
sebastianbergmann:master
from
epdenouden:feature/issue-3519-depends-on-class
Jun 15, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## master #3936 +/- ##
============================================
+ Coverage 84.67% 84.70% +0.02%
- Complexity 4551 4563 +12
============================================
Files 257 257
Lines 11428 11487 +59
============================================
+ Hits 9677 9730 +53
- Misses 1751 1757 +6
Continue to review full report at Codecov.
|
sebastianbergmann
changed the title
Feature: declare class-based dependencies using
Ceclare class-based dependencies using Mar 30, 2020
@depends
@depends
sebastianbergmann
added
the
feature/test-dependencies
Issues related to explicitly declared dependencies between tests
label
Mar 30, 2020
sebastianbergmann
changed the title
Ceclare class-based dependencies using
Declare class-based dependencies using Mar 30, 2020
@depends
@depends
3 tasks
mvriel
reviewed
Jun 15, 2020
localheinz
reviewed
Jun 15, 2020
localheinz
reviewed
Jun 15, 2020
localheinz
reviewed
Jun 15, 2020
localheinz
reviewed
Jun 15, 2020
localheinz
reviewed
Jun 15, 2020
localheinz
reviewed
Jun 15, 2020
localheinz
reviewed
Jun 15, 2020
3 tasks
Thank you so much, @epdenouden and @localheinz, for working on this! |
localheinz
reviewed
Jun 15, 2020
localheinz
reviewed
Jun 15, 2020
localheinz
reviewed
Jun 15, 2020
sebastianbergmann
changed the title
Declare class-based dependencies using
Support using @depends to depend on classes
Jun 15, 2020
@depends
This was referenced Jun 15, 2020
fabpot
added a commit
to symfony/symfony
that referenced
this pull request
Aug 8, 2020
…s (derrabus) This PR was merged into the 5.1 branch. Discussion ---------- [String] We cannot have a "provides" function in test cases | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Part of #37564 | License | MIT | Doc PR | N/A Because of a change in PHPUnit 9.3 (see sebastianbergmann/phpunit#3936), we cannot have define a method named `provides` in test cases. And since php is case-insensitive regarding method calls, the method `provideS` used by the String component's `FunctionTest` will cause a fatal error. I have renamed it to work around that issue. cc @fancyweb Commits ------- 46e2a0c [String] We cannot have a "provides" function in test cases.
This was referenced Sep 21, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
feature/test-dependencies
Issues related to explicitly declared dependencies between tests
type/enhancement
A new idea that should be implemented
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use case
As a developer of PHPUnit test collections
I want to declare dependencies between tests and whole
TestCase
classesso that large or interdependent collections can be more easily managed
This implements feature request #3519 by adding support for declaring interdependency between a test and a
TestCase
class using the existing@depends
annotation. This is often useful for managing slow integration suites: "don't even try this ifSomeTestClass
didn't pass."Detailed use case with additional context provided by @spriebsch.
Example
Example from the new unit test
DependencyOnClassTest
and configuration fileImplementation
TestSuiteSorter
@depends SomeTest::class
dependency check mechanismTestSuite
objects based on its child testsTestCase::class
is considered passed if it doesn't contain any failing testsGroundwork for future improvements
@dataProvider
prototype to production code will be much easier with all the new plumbingTesting
The new functionality is guarded by multiple unit and end-to-end tests.
@depends
resolver mechanism@depends
+@size
handlingTo do
@depends
-annotation normalization as this is provided by user input and not reflectionTestSuite
pass/fail tracking inTestResult
TestSuite
based on@depends ::class
provides
/requires
dependency resolverTestSuite
DataProviderTestSuite
TestCase
PhptTestCase
TestSuiteSorter
with new oneTestSuite
dirty flaggingNotes
I realize there will be edge-cases with a new feature like this. Give it a try and let me know what you think!
Ping @barbu110