Commit 50a6a9ef authored by catch's avatar catch
Browse files

Issue #3060391 by mondrake, Mile23, Lendude, alexpott: Cleanup usage of PHPUnit 4.8 aliased classes

parent 1240a8a0
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Extension\ExtensionDiscovery;
use Drupal\Core\Test\Exception\MissingGroupException;
use PHPUnit_Util_Test;
use PHPUnit\Util\Test;

/**
 * Discovers available tests.
@@ -418,14 +418,14 @@ public static function parseTestClassSummary($doc_comment) {
   *     - module: A list of Drupal module dependencies that are required to
   *       exist.
   *
   * @see PHPUnit_Util_Test::parseTestMethodAnnotations()
   * @see \PHPUnit\Util\Test::parseTestMethodAnnotations()
   * @see http://phpunit.de/manual/current/en/incomplete-and-skipped-tests.html#incomplete-and-skipped-tests.skipping-tests-using-requires
   */
  public static function parseTestClassAnnotations(\ReflectionClass $class) {
    $annotations = PHPUnit_Util_Test::parseTestMethodAnnotations($class->getName())['class'];
    $annotations = Test::parseTestMethodAnnotations($class->getName())['class'];

    // @todo Enhance PHPUnit upstream to allow for custom @requires identifiers.
    // @see PHPUnit_Util_Test::getRequirements()
    // @see \PHPUnit\Util\Test::getRequirements()
    // @todo Add support for 'PHP', 'OS', 'function', 'extension'.
    // @see https://www.drupal.org/node/1273478
    if (isset($annotations['requires'])) {
+2 −2
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ class AggregatorPluginSettingsBaseTest extends UnitTestCase {
  /**
   * The stubbed config factory object.
   *
   * @var \PHPUnit_Framework_MockObject_MockBuilder
   * @var \PHPUnit\Framework\MockObject\MockBuilder
   */
  protected $configFactory;

@@ -56,7 +56,7 @@ protected function setUp() {
        ->will($this->returnValue(['aggregator_test' => ['title' => '', 'description' => '']]));
    }

    /** @var \Drupal\Core\Messenger\MessengerInterface|\PHPUnit_Framework_MockObject_MockBuilder $messenger */
    /** @var \Drupal\Core\Messenger\MessengerInterface|\PHPUnit\Framework\MockObject\MockBuilder $messenger */
    $messenger = $this->createMock(MessengerInterface::class);
    $messenger->expects($this->any())->method('addMessage');

+3 −2
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
use Drupal\field\Entity\FieldConfig;
use Drupal\Tests\field\Kernel\FieldKernelTestBase;
use Drupal\field\Entity\FieldStorageConfig;
use PHPUnit\Framework\AssertionFailedError;

/**
 * Tests the new entity API for the date field type.
@@ -255,7 +256,7 @@ public function testSetValueProperty() {
   * @dataProvider datetimeValidationProvider
   */
  public function testDatetimeValidation($value) {
    $this->expectException(\PHPUnit_Framework_AssertionFailedError::class);
    $this->expectException(AssertionFailedError::class);

    $this->fieldStorage->setSetting('datetime_type', DateTimeItem::DATETIME_TYPE_DATETIME);
    $this->fieldStorage->save();
@@ -315,7 +316,7 @@ public function datetimeValidationProvider() {
   * @dataProvider dateonlyValidationProvider
   */
  public function testDateonlyValidation($value) {
    $this->expectException(\PHPUnit_Framework_AssertionFailedError::class);
    $this->expectException(AssertionFailedError::class);

    $this->fieldStorage->setSetting('datetime_type', DateTimeItem::DATETIME_TYPE_DATE);
    $this->fieldStorage->save();
+2 −1
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\file\Entity\File;
use Drupal\user\Entity\Role;
use PHPUnit\Framework\Error\Warning;

/**
 * Tests using entity fields of the image field type.
@@ -153,7 +154,7 @@ public function testImageItemMalformed() {
      $this->fail('Exception did not fail');
    }
    catch (EntityStorageException $exception) {
      $this->assertInstanceOf(\PHPUnit_Framework_Error_Warning::class, $exception->getPrevious());
      $this->assertInstanceOf(Warning::class, $exception->getPrevious());
      $this->assertEquals($exception->getMessage(), 'Missing file with ID 9999.');
      $this->assertEmpty($entity->image_test->width);
      $this->assertEmpty($entity->image_test->height);
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ class LocaleLookupTest extends UnitTestCase {
  /**
   * A mocked config factory built with UnitTestCase::getConfigFactoryStub().
   *
   * @var \Drupal\Core\Config\ConfigFactory|\PHPUnit_Framework_MockObject_MockBuilder
   * @var \Drupal\Core\Config\ConfigFactory|\PHPUnit\Framework\MockObject\MockBuilder
   */
  protected $configFactory;

Loading