Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295536

Allow PHPUnit 5+ support

$
0
0

Problem/Motivation

Drupal 8 should fully support PHP 7. PHP 7 includes the ability to type hint primitives, and explicitly declare the return type of methods:

public function foo(string $bar) : string {
  // Implementation here.
}

However, this causes PHPUnit <= 5 to fail because it does not support these concepts. It will fail because <= 5, it cannot create mocks that have these explicit types.

Updating PHPUnit to version 5 does work in theory, but unit tests are littered with deprecation warnings because PHPUnit_Framework_TestCase::getMock() is deprecated, and this is used all over the place in Drupal base unit test classes.

Proposed resolution

Replace all instances of the deprecated PHPUnit_Framework_TestCase::getMock() with getMockBuilder() or createMock() as suggested by PHPUnit.

There might also be other consequences to updating PHPUnit that I have not discovered.

Remaining tasks

All.


Viewing all articles
Browse latest Browse all 295536


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>