Closed (fixed)
Project:
Drupal core
Version:
8.6.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Anonymous (not verified)
Created:
21 Feb 2018 at 12:27 UTC
Updated:
10 Nov 2018 at 20:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Anonymous (not verified) commentedvaplas created an issue. See original summary.
Comment #2
Anonymous (not verified) commentedComment #4
Anonymous (not verified) commentedComment #6
Anonymous (not verified) commentedComment #7
Anonymous (not verified) commentedAlso added \Drupal\comment\TestsCommentCacheTagsTest from scope of #2862508: Convert system functional tests to phpunit. And this is stated in the #2866513: Convert web tests to browser tests for comment module.
Comment #8
lendude@vaplas uhh just wondering why this went from being the 'module' conversion to being the 'entity' conversion? And why the patch number uses the issue number for #2946425: Correcting the tests that lie in BTB but using WTB, doing too many things at the same time again? :)
This looks great for the entity conversion. Nice and clean. One thing:
We should never add new deprecations to this, just take them out. Are there any uses of this left in core after this conversion? If so, why? If not, there is no reason to add them, plus there is a typo in the last one, so it won't work anyway :).
Comment #9
Anonymous (not verified) commented@Lendude, it was not my star day)))
#2822382: Make every $modules property protected on classes extending BrowserTestBase and KernelTestBase found 13 tests WTB tests in BTB location. I wanted to fix them all in one file, but then I guessed to file the Entity cases to a separate issue (🏅), because to solve them it was necessary to convert part system/entity.
+ 'Drupal\system\Tests\Entity\EntityDefinitionTestTrait is deprecated in Drupal 8.5.0It was a real wtf moment for me. I can not explain it, but without this change all tests with
$modules = ['simpletest']are fail. See #4 (and current test-only). Despite the fact that no one uses it.Debug of
OtherInstallationProfileTestsTestsays thatEntityDefinitionTestTraitit is requested only once in:But it seems this does not apply to
EntityWithUriCacheTagsTestBase(after your fair point about typo :)Comment #10
Anonymous (not verified) commentedReupload 2946419-9.patch with
diff --find-copies.Comment #12
Anonymous (not verified) commentedOne more unrelated nit change due to #2948700: Casting $text value to string in responseContains/responseNotContains methods.
Comment #13
Anonymous (not verified) commentedFiled #2949363: Impossible to make trigger_error in some files without test fails for problem with unexpected deprecated trigger.
Comment #14
zymbian commentedPatch looks good to me , thanks for the patch.
Comment #15
lendudeLets postpone on #2949363: Impossible to make trigger_error in some files without test fails, because deprecating the trait is the right thing to do and we really don't want to add to that list of suppressed deprecation warnings.
Comment #16
mile23EntityDefinitionTestTraitis loaded during test discovery. Since@trigger_error()is in the file, it is not triggered when the trait is used, only when the file is loaded.So this means that if any test discovery system scans the file system in that directory, it's going to end up triggering the error if it requires, includes or uses reflection on that trait.
There is the Traits directory, but since we're trying to deprecate a trait in-place, that won't work. Traits in the Traits directory can be autoloaded, but won't scanned for tests. You can see an example of this in simpletest module: http://cgit.drupalcode.org/drupal/tree/core/modules/simpletest/tests/src
This is also a bit of an argument in favor of #2296635: Evaluate performance impact of limiting test discovery to *Test.php filename suffix since that would filter out files ending in Trait.php.
The solution here is to not @trigger_error(), and to file a followup to eventually add it. Add a @todo in the deprecated trait.
Comment #17
Anonymous (not verified) commented@Mile23 thanks for review and clarification of what is happening here!
However, solution without
@trigger_errormay be unacceptable. Perhaps it's better to add a @todo toDeprecationListenerTraitline:At least if someone creates tests with deprecated trait, the IDE will help about it through a strike trait.
Or just wait #2296635: Evaluate performance impact of limiting test discovery to *Test.php filename suffix.
Comment #18
Anonymous (not verified) commented#2949363: Impossible to make trigger_error in some files without test fails 🎉
Due to many changes in the
DeprecationListenerTrait, we can fix fail like simple reroll. But I specifically added this line to manually remove it again :)Also nit update: 8.5.0/8.5.x
Comment #19
borisson_I can't see anything wrong with this patch, looks very good.
Comment #20
mile23Diggit. :-) Pretty close...
Add @see to the CR in these docblocks. Also, it's deprecated in 8.6.x now.
Adding 'needs IS update' because of this question from #8: "@vaplas uhh just wondering why this went from being the 'module' conversion to being the 'entity' conversion?"
Adding #2977105: Incomplete functional conversion for NodeCacheTagsTest as related. We might end up closing that one if this one gets all the things.
Comment #21
lendude@Mile23 thanks for the review!
Updated the IS a bit, but the answer to #8 was in #9, it was a failed clone attempt :)
Updated the version numbers and added the needed @see's. Interdiff is a little weird, but that tends to happen with --find-copy patches.
Comment #22
mile23LGTM.
Comment #24
phenaproximaI'm fairly sure this is blocking #2976889: Add a trait to create media types in tests and replace MediaFunctionalTestCreateMediaTypeTrait.
Comment #25
lenduderandom fail
Comment #26
borisson_The random fail was in
Drupal\Tests\media\FunctionalJavascript\MediaSourceFileTest, so not related to this testcode.Comment #27
alexpottCommitted 646584b and pushed to 8.6.x. Thanks!
Can we also get a follow-up to fix PHPUnit tests that extend \Drupal\system\Tests\Entity\EntityCacheTagsTestBase since that is also WTB. This is the problem with run-tests.sh it's far too clever for its own boots automatically determining test types using reflection.
Comment #29
mile23The follow-up was already related: #2977105: Incomplete functional conversion for NodeCacheTagsTest
I just marked it closed because this issue fixed it.
Comment #30
mile23A bit of a follow-up to show us where the problem lies: #2981678: Fail PHPUnit-based tests which still inherit from WTB/TB.