Problem/Motivation
Sebastian Bergmann added a forward compability layer for phpunit 4.8, see https://github.com/sebastianbergmann/phpunit/commit/a55235c033c2dc18db63...
This allows us to ease a migration to phpunit 6, once we decide to jump onto php 7 or phpunit 5 when we go to 5.6
Proposed resolution
Use the new classes instead of the old ones.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 2850797-5-9.patch | 31.83 KB | maxocub |
| #5 | interdiff-2-5.txt | 17.08 KB | maxocub |
| #5 | 2850797-5.patch | 31.76 KB | maxocub |
| #2 | 2850797-2.patch | 30.72 KB | maxocub |
Comments
Comment #2
maxocub commentedComment #3
dawehnerNice fix! I cannot think about a reason why this should break BC. I wonder though whether we should update the documents about how to write phpunit tests ... ideally we would not yet, given that the new base class requires the most uptodate phpunit version, and the old documentation still supports what existed before.
Comment #4
alexpottSo I think for core unit tests we should ensure that they are using \Drupal\Tests\UnitTestCase it is just a mistake that they are not.
Let's add a use statement and do TestCase::class.
This might be an exception to the use \Drupal\Tests\UnitTestCase rule - if it doesn't work then it should be documented why.
Use and ::class
In component tests this is totally correct - they should NOT use \Drupal\Tests\UnitTestCase
These should use \Drupal\Tests\UnitTestCase because it's core (and not component)
Comment #5
maxocub commentedMade all the changes from #4, thanks for the review!
Comment #6
dawehner@maxocub Do you want to create a followup to remove all the usages of
UnitTestCasein the component tests?Comment #8
maxocub commented@dawehner: Yes, I'll do that.
Comment #9
maxocub commented#2865413: Move RegisterSerializationClassesCompilerPassTest.php to correct location moved RegisterSerializationClassesCompilerPassTest, so the patch didn't apply anymore. Here's a new one. I don't have an interdiff since it's just one class that moved.
Comment #10
dawehnerBack to RTBC
Comment #11
wim leersI think #10 was a typo? :)
Comment #12
martin107 commentedout becomes our
Comment #13
alexpottCommitted 75f0c02 and pushed to 8.4.x. Thanks!
Comment #15
wim leersFYI: if you're getting errors like this after updating to this commit or later:
Then you should run
composer install. Your composer dependencies are outdated. (Mine were, as you can tell.)Comment #16
maxocub commentedI created the follow-up #2866894: Component tests should not use Drupal\Tests\UnitTestCase but PHPUnit\Framework\TestCase to remove all the usages of UnitTestCase in the component tests.
Comment #17
gábor hojtsyAdding to release notes.
Comment #18
dagmar@Gábor Hojtsy this seems to be only available for 8.4.x
Comment #19
gábor hojtsyUhm, indeed, sorry.
Comment #20
xjm:)
Comment #22
maxocub commented