Verified Commit 35a8fc6d authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3433088 by mondrake, Spokje: Method getMockForAbstractClass() of class...

Issue #3433088 by mondrake, Spokje: Method getMockForAbstractClass() of class PHPUnit\Framework\TestCase is deprecated in PHPUnit 10 - Step 1 interfaces
parent 2a797ad1
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -267,7 +267,7 @@ public function testLoadByEntityTypeBundle($config_id, ContentLanguageSettings $
      ->with('language_content_settings')
      ->willReturn($this->configEntityStorageInterface);

    $entity_type_repository = $this->getMockForAbstractClass(EntityTypeRepositoryInterface::class);
    $entity_type_repository = $this->createMock(EntityTypeRepositoryInterface::class);
    $entity_type_repository->expects($this->any())
      ->method('getEntityTypeFromClass')
      ->with(ContentLanguageSettings::class)
+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ public function testCalculateDependencies() {
      ->with('image_style')
      ->willReturn($storage);

    $entity_type_repository = $this->getMockForAbstractClass(EntityTypeRepositoryInterface::class);
    $entity_type_repository = $this->createMock(EntityTypeRepositoryInterface::class);
    $entity_type_repository->expects($this->any())
      ->method('getEntityTypeFromClass')
      ->with('Drupal\image\Entity\ImageStyle')
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ public function testTitleQuery() {
    ], 'user_role');

    // Creates a stub entity storage;
    $role_storage = $this->getMockForAbstractClass('Drupal\Core\Entity\EntityStorageInterface');
    $role_storage = $this->createMock('Drupal\Core\Entity\EntityStorageInterface');
    $role_storage->expects($this->any())
      ->method('loadMultiple')
      ->willReturnMap([
+3 −9
Original line number Diff line number Diff line
@@ -49,9 +49,7 @@ public function testGetContextValue($expected, $context_value, $is_required, $da
    // throwing an exception if the definition requires it.
    else {
      // Create a mock definition.
      $mock_definition = $this->getMockBuilder('Drupal\Component\Plugin\Context\ContextDefinitionInterface')
        ->onlyMethods(['isRequired', 'getDataType'])
        ->getMockForAbstractClass();
      $mock_definition = $this->createMock('Drupal\Component\Plugin\Context\ContextDefinitionInterface');

      // Set expectation for isRequired().
      $mock_definition->expects($this->once())
@@ -103,9 +101,7 @@ public static function providerHasContextValue() {
   * @dataProvider providerHasContextValue
   */
  public function testHasContextValue($has_context_value, $default_value): void {
    $mock_definition = $this->getMockBuilder('Drupal\Component\Plugin\Context\ContextDefinitionInterface')
      ->onlyMethods(['getDefaultValue'])
      ->getMockForAbstractClass();
    $mock_definition = $this->createMock('Drupal\Component\Plugin\Context\ContextDefinitionInterface');

    $mock_definition->expects($this->atLeastOnce())
      ->method('getDefaultValue')
@@ -121,9 +117,7 @@ public function testHasContextValue($has_context_value, $default_value): void {
   * @covers ::getContextValue
   */
  public function testDefaultValue() {
    $mock_definition = $this->getMockBuilder('Drupal\Component\Plugin\Context\ContextDefinitionInterface')
      ->onlyMethods(['getDefaultValue'])
      ->getMockForAbstractClass();
    $mock_definition = $this->createMock('Drupal\Component\Plugin\Context\ContextDefinitionInterface');

    $mock_definition->expects($this->once())
      ->method('getDefaultValue')
+4 −9
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@

namespace Drupal\Tests\Component\Plugin\Discovery;

use Drupal\Component\Plugin\Discovery\DiscoveryInterface;
use Drupal\Component\Plugin\Discovery\StaticDiscovery;
use Drupal\Component\Plugin\Discovery\StaticDiscoveryDecorator;
use PHPUnit\Framework\TestCase;
@@ -26,9 +27,7 @@ class StaticDiscoveryDecoratorTest extends TestCase {
   *   called once.
   */
  public function getRegisterDefinitionsCallback() {
    $mock_callable = $this->getMockBuilder(StaticDiscoveryDecoratorTestMockInterface::class)
      ->onlyMethods(['registerDefinitionsCallback'])
      ->getMock();
    $mock_callable = $this->createMock(StaticDiscoveryDecoratorTestMockInterface::class);
    // Set expectations for the callback method.
    $mock_callable->expects($this->once())
      ->method('registerDefinitionsCallback');
@@ -88,9 +87,7 @@ public function testGetDefinition($expected, $has_register_definitions, $excepti
    $ref_definitions->setValue($mock_decorator, []);

    // Mock a decorated object.
    $mock_decorated = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryInterface')
      ->onlyMethods(['getDefinitions'])
      ->getMockForAbstractClass();
    $mock_decorated = $this->createMock(DiscoveryInterface::class);
    // Return our definitions from getDefinitions().
    $mock_decorated->expects($this->once())
      ->method('getDefinitions')
@@ -155,9 +152,7 @@ public function testGetDefinitions($has_register_definitions, $definitions) {
    $ref_definitions->setValue($mock_decorator, []);

    // Mock a decorated object.
    $mock_decorated = $this->getMockBuilder('Drupal\Component\Plugin\Discovery\DiscoveryInterface')
      ->onlyMethods(['getDefinitions'])
      ->getMockForAbstractClass();
    $mock_decorated = $this->createMock(DiscoveryInterface::class);
    // Our mocked method will return any arguments sent to it.
    $mock_decorated->expects($this->once())
      ->method('getDefinitions')
Loading