Issue #3126969 by mondrake, longwave, alexpott, daffie: Replace usage of assertAttributeInstanceOf() that is deprecated
parent
701a778095
commit
de981ef81e
|
@ -243,8 +243,8 @@ class EntityTypeManagerTest extends UnitTestCase {
|
|||
|
||||
$apple_form = $this->entityTypeManager->getFormObject('apple', 'default');
|
||||
$this->assertInstanceOf(TestEntityForm::class, $apple_form);
|
||||
$this->assertAttributeInstanceOf(ModuleHandlerInterface::class, 'moduleHandler', $apple_form);
|
||||
$this->assertAttributeInstanceOf(TranslationInterface::class, 'stringTranslation', $apple_form);
|
||||
$this->assertInstanceOf(ModuleHandlerInterface::class, $apple_form->moduleHandler);
|
||||
$this->assertInstanceOf(TranslationInterface::class, $apple_form->stringTranslation);
|
||||
|
||||
$banana_form = $this->entityTypeManager->getFormObject('banana', 'default');
|
||||
$this->assertInstanceOf(TestEntityFormInjected::class, $banana_form);
|
||||
|
@ -272,7 +272,7 @@ class EntityTypeManagerTest extends UnitTestCase {
|
|||
* @covers ::getHandler
|
||||
*/
|
||||
public function testGetHandler() {
|
||||
$class = $this->getTestHandlerClass();
|
||||
$class = get_class($this->getMockForAbstractClass(TestEntityHandlerBase::class));
|
||||
$apple = $this->prophesize(EntityTypeInterface::class);
|
||||
$apple->getHandlerClass('storage')->willReturn($class);
|
||||
|
||||
|
@ -282,8 +282,8 @@ class EntityTypeManagerTest extends UnitTestCase {
|
|||
|
||||
$apple_controller = $this->entityTypeManager->getHandler('apple', 'storage');
|
||||
$this->assertInstanceOf($class, $apple_controller);
|
||||
$this->assertAttributeInstanceOf(ModuleHandlerInterface::class, 'moduleHandler', $apple_controller);
|
||||
$this->assertAttributeInstanceOf(TranslationInterface::class, 'stringTranslation', $apple_controller);
|
||||
$this->assertInstanceOf(ModuleHandlerInterface::class, $apple_controller->moduleHandler);
|
||||
$this->assertInstanceOf(TranslationInterface::class, $apple_controller->stringTranslation);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -312,8 +312,8 @@ class EntityTypeManagerTest extends UnitTestCase {
|
|||
|
||||
$apple_route_provider = $this->entityTypeManager->getRouteProviders('apple');
|
||||
$this->assertInstanceOf(TestRouteProvider::class, $apple_route_provider['default']);
|
||||
$this->assertAttributeInstanceOf(ModuleHandlerInterface::class, 'moduleHandler', $apple_route_provider['default']);
|
||||
$this->assertAttributeInstanceOf(TranslationInterface::class, 'stringTranslation', $apple_route_provider['default']);
|
||||
$this->assertInstanceOf(ModuleHandlerInterface::class, $apple_route_provider['default']->moduleHandler);
|
||||
$this->assertInstanceOf(TranslationInterface::class, $apple_route_provider['default']->stringTranslation);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -396,6 +396,26 @@ class EntityTypeManagerTest extends UnitTestCase {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a test entity handler.
|
||||
*/
|
||||
abstract class TestEntityHandlerBase extends EntityHandlerBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $moduleHandler;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $stringTranslation;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a test entity type manager.
|
||||
*/
|
||||
class TestEntityTypeManager extends EntityTypeManager {
|
||||
|
||||
/**
|
||||
|
@ -415,6 +435,16 @@ class TestEntityTypeManager extends EntityTypeManager {
|
|||
*/
|
||||
class TestEntityForm extends EntityHandlerBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $moduleHandler;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $stringTranslation;
|
||||
|
||||
/**
|
||||
* The entity type manager.
|
||||
*
|
||||
|
@ -496,4 +526,14 @@ class TestEntityFormInjected extends TestEntityForm implements ContainerInjectio
|
|||
*/
|
||||
class TestRouteProvider extends EntityHandlerBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $moduleHandler;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $stringTranslation;
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ trait PHPUnit8Warnings {
|
|||
'readAttribute() is deprecated and will be removed in PHPUnit 9.',
|
||||
'getObjectAttribute() is deprecated and will be removed in PHPUnit 9.',
|
||||
'assertAttributeEquals() is deprecated and will be removed in PHPUnit 9.',
|
||||
'assertAttributeInstanceOf() is deprecated and will be removed in PHPUnit 9.',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue