Closed (fixed)
Project:
Drupal core
Version:
8.5.x-dev
Component:
phpunit
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Jan 2018 at 21:19 UTC
Updated:
22 Jan 2018 at 15:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
neclimdulThanks alex. I took a stab at this but either I'm doing something wrong or it is a bit tricky. Fixing one problem causes different failures.
Comment #3
alexpottSo we can fix
Drupal\Tests\Core\Test\PhpUnitBridgeTestreally simply. But the other one is an interesting tangle because even making it run in a separate process doesn't fix it because the @covers checking in \Drupal\Tests\Listeners\DrupalStandardsListenerTrait causes the class to be loaded. Not sure how to get around that. Ideally\Drupal\Tests\Listeners\DrupalStandardsListenerTraitwould not trigger deprecation errors.Comment #4
alexpottThis is green... what fun. There's a bug in Symfony's PHPUnit deprecation counter whereby you only need to match on one expected deprecation for a pass. Given their focus on unit tests it's obviously the multiple deprecation testing probably needs more test coverage.
Comment #6
neclimdulhahahaha see... tricky.
"you only need to match on one expected deprecation for a pass."
Not sure about how the deprecation matching is implemented but are they handled through exceptions? If so the first one will stop execution and you can never have more then one match so matching any expected exception makes sense.
Comment #7
neclimdulI spent some time banging on this and am basically cross eyed and delirious now so documenting what I've seen.
1) Obviously not exceptions. You're working with the error handler to fix things. derp on my part.
2) That error handling change is the "problem". Removing it "fixes" the tests.
3) "problem" and "fixes" because I don't think they ever tested what we thought. They tested the coverage weirdness because removing the covers annotations on a clean install causes the assertion to fail in both run-test.sh and phpunit
4) There _should_ be a deprecation to test in both of these tests. Neither work and it seems connected to the subprocess phpunit serialization magic which might not be working correctly in Drupal's test suite. Inspecting the serialized value reveals an empty array.
All of this to say, I think this patch might be fine the way it is but our deprecation testing doesn't seem to work 100%. Bonus observation, since unit tests run in their own process on testbot and their testing works, it is likely something kernel tests do specifically that is breaking things.
Comment #8
alexpottAh the fun. So we shouldn't be skipping deprecations when we are dealing with a legacy test. The only reason this test generates deprecation notices in HEAD atm is the Drupal standards checker which is obviously nonsense.
Comment #9
alexpottSome minor improvements.
Comment #10
neclimdulThank god you knew where to look because I was going in circles trying to figure out how the interprocess communications wasn't working.
Think this is the only thing keeping it from being RTBC
Comment #11
alexpott@neclimdul I think we should just have a comment for that. It needs to be in a separate process because some other test is also loading the code so the deprecation error is not triggered unless this is in a separate process.
Comment #12
neclimdulcurrently they're not running in a separate process though. there's an "a" in front.
Comment #13
alexpott@neclimdul lol - yeah right - at one point that was necessary but once I fixed the standards checker to ignore deprecations it was no longer necessary... new patch.
Comment #14
neclimdul:-D wfm. No real change from previous patch so going to assume it'll pass and preemptively RTBC.
Comment #15
larowlanCrediting @neclimdul for the time spent on #7
Comment #17
larowlanCommitted as 891c39b and pushed to 8.5.x
Thanks folks
Comment #18
wim leersShouldn't we have a CR for these? Apparently I can write test methods like
testLegacySomethingBlah()and it won't skip deprecations?Also: we have nothing that actually uses this?
Comment #19
alexpott@Wim Leers this is not really from us this is from Symfony. See https://github.com/symfony/phpunit-bridge/blob/master/DeprecationErrorHa... - nothing has actually changed here. In order to get Symfony's deprecation testing we can't have test methods or classes with legacy in the name as this is deprecated (by Symfony).
Comment #20
wim leersAhhh! A comment indicating that that's there just to match upstream logic would've helped make that clear: wouldn't have asked then.
Comment #22
narasimhan_gobear commentedHi all : Is there a ticket for following the upstream changes and adding them later within
phpunit?Edit : I made the above comment before learning about
symfony/phpunit-bridge. Please ignore