Unverified Commit de981ef8 authored by alexpott's avatar alexpott
Browse files

Issue #3126969 by mondrake, longwave, alexpott, daffie: Replace usage of...

Issue #3126969 by mondrake, longwave, alexpott, daffie: Replace usage of assertAttributeInstanceOf() that is deprecated
parent 701a7780
......@@ -243,8 +243,8 @@ public function testGetFormObject() {
$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 @@ public function testGetFormObjectInvalidOperation() {
* @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 @@ public function testGetHandler() {
$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 @@ public function testGetRouteProviders() {
$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 @@ protected function getTestHandlerClass() {
}
/**
* 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 @@ public function setDiscovery(DiscoveryInterface $discovery) {
*/
class TestEntityForm extends EntityHandlerBase {
/**
* {@inheritdoc}
*/
public $moduleHandler;
/**
* {@inheritdoc}
*/
public $stringTranslation;
/**
* The entity type manager.
*
......@@ -496,4 +526,14 @@ public static function create(ContainerInterface $container) {
*/
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.',
];
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment