Skip to content
Snippets Groups Projects
Commit 49720dc8 authored by catch's avatar catch
Browse files

Issue #3464213 by mondrake: Method getMockForAbstractClass() of class...

Issue #3464213 by mondrake: Method getMockForAbstractClass() of class PHPUnit\Framework\TestCase is deprecated in PHPUnit 10 - replace in Plugin component tests
parent bd4a29da
No related branches found
No related tags found
19 merge requests!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!9470[10.3.x-only-DO-NOT-MERGE]: #3331771 Fix file_get_contents(): Passing null to parameter,!8736Update the Documention As per the Function uses.,!8513Issue #3453786: DefaultSelection should document why values for target_bundles NULL and [] behave as they do,!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3133core/modules/system/css/components/hidden.module.css,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493
Pipeline #248702 passed with warnings
Pipeline: drupal

#248730

    Pipeline: drupal

    #248715

      Pipeline: drupal

      #248709

        ......@@ -2521,18 +2521,6 @@
        'count' => 1,
        'path' => __DIR__ . '/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php',
        ];
        $ignoreErrors[] = [
        // identifier: method.deprecated
        'message' => '#^Call to deprecated method getMockForAbstractClass\\(\\) of class PHPUnit\\\\Framework\\\\TestCase\\.$#',
        'count' => 4,
        'path' => __DIR__ . '/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php',
        ];
        $ignoreErrors[] = [
        // identifier: method.deprecated
        'message' => '#^Call to deprecated method getMockForAbstractClass\\(\\) of class PHPUnit\\\\Framework\\\\MockObject\\\\MockBuilder\\.$#',
        'count' => 2,
        'path' => __DIR__ . '/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php',
        ];
        $ignoreErrors[] = [
        'message' => '#^Missing cache backend declaration for performance\\.$#',
        'count' => 1,
        ......
        ......@@ -17,11 +17,11 @@ class PluginBaseTest extends TestCase {
        * @covers ::getPluginId
        */
        public function testGetPluginId($plugin_id, $expected): void {
        $plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', [
        $plugin_base = new StubPluginBase(
        [],
        $plugin_id,
        [],
        ]);
        );
        $this->assertEquals($expected, $plugin_base->getPluginId());
        }
        ......@@ -43,12 +43,11 @@ public static function providerTestGetPluginId() {
        * @coves ::getBaseId
        */
        public function testGetBaseId($plugin_id, $expected): void {
        /** @var \Drupal\Component\Plugin\PluginBase|\PHPUnit\Framework\MockObject\MockObject $plugin_base */
        $plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', [
        $plugin_base = new StubPluginBase(
        [],
        $plugin_id,
        [],
        ]);
        );
        $this->assertEquals($expected, $plugin_base->getBaseId());
        }
        ......@@ -70,12 +69,11 @@ public static function providerTestGetBaseId() {
        * @covers ::getDerivativeId
        */
        public function testGetDerivativeId($plugin_id = NULL, $expected = NULL): void {
        /** @var \Drupal\Component\Plugin\PluginBase|\PHPUnit\Framework\MockObject\MockObject $plugin_base */
        $plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', [
        $plugin_base = new StubPluginBase(
        [],
        $plugin_id,
        [],
        ]);
        );
        $this->assertEquals($expected, $plugin_base->getDerivativeId());
        }
        ......@@ -96,11 +94,11 @@ public static function providerTestGetDerivativeId() {
        * @covers ::getPluginDefinition
        */
        public function testGetPluginDefinition(): void {
        $plugin_base = $this->getMockForAbstractClass('Drupal\Component\Plugin\PluginBase', [
        $plugin_base = new StubPluginBase(
        [],
        'plugin_id',
        ['value', ['key' => 'value']],
        ]);
        );
        $this->assertEquals(['value', ['key' => 'value']], $plugin_base->getPluginDefinition());
        }
        ......
        ......@@ -6,7 +6,6 @@
        use Drupal\Component\Plugin\Exception\PluginNotFoundException;
        use Drupal\Component\Plugin\Mapper\MapperInterface;
        use Drupal\Component\Plugin\PluginManagerBase;
        use PHPUnit\Framework\TestCase;
        use Prophecy\PhpUnit\ProphecyTrait;
        ......@@ -51,8 +50,7 @@ public function getMockFactoryInterface($expects_count) {
        * @covers ::createInstance
        */
        public function testCreateInstance(): void {
        $manager = $this->getMockBuilder('Drupal\Component\Plugin\PluginManagerBase')
        ->getMockForAbstractClass();
        $manager = new StubPluginManagerBase();
        // PluginManagerBase::createInstance() looks for a factory object and then
        // calls createInstance() on it. So we have to mock a factory object.
        $factory_ref = new \ReflectionProperty($manager, 'factory');
        ......@@ -118,9 +116,7 @@ public function testGetInstanceWithoutMapperShouldThrowException(): void {
        'foo' => 'F00',
        'bar' => 'bAr',
        ];
        /** @var \Drupal\Component\Plugin\PluginManagerBase $manager */
        $manager = $this->getMockBuilder(PluginManagerBase::class)
        ->getMockForAbstractClass();
        $manager = new StubPluginManagerBase();
        // Set the expected exception thrown by ::getInstance.
        $this->expectException(\BadMethodCallException::class);
        $this->expectExceptionMessage(sprintf('%s does not support this method unless %s::$mapper is set.', get_class($manager), get_class($manager)));
        ......
        <?php
        declare(strict_types=1);
        namespace Drupal\Tests\Component\Plugin;
        use Drupal\Component\Plugin\PluginBase;
        /**
        * A class extending PluginBase for testing purposes.
        */
        class StubPluginBase extends PluginBase {
        }
        <?php
        declare(strict_types=1);
        namespace Drupal\Tests\Component\Plugin;
        use Drupal\Component\Plugin\PluginManagerBase;
        /**
        * A class extending PluginManagerBase for testing purposes.
        */
        class StubPluginManagerBase extends PluginManagerBase {
        }
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment