Issue #3456890 by TravisCarden, smustgrave: 'The "%plugin_id" was not found' warning message is confusing

merge-requests/8631/head
Alex Pott 2024-07-02 10:26:42 +01:00
parent 57325ce447
commit 54f16eb60c
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
3 changed files with 4 additions and 4 deletions

View File

@ -90,7 +90,7 @@ class BlockManager extends DefaultPluginManager implements BlockManagerInterface
* {@inheritdoc}
*/
protected function handlePluginNotFound($plugin_id, array $configuration) {
$this->logger->warning('The "%plugin_id" was not found', ['%plugin_id' => $plugin_id]);
$this->logger->warning('The "%plugin_id" block plugin was not found', ['%plugin_id' => $plugin_id]);
return parent::handlePluginNotFound($plugin_id, $configuration);
}

View File

@ -181,12 +181,12 @@ class ConfigImporterMissingContentTest extends KernelTestBase implements LoggerI
$this->logMessages = [];
$config_importer = $this->configImporter();
$config_importer->import();
$this->assertNotContains('The "block_content:6376f337-fcbf-4b28-b30e-ed5b6932e692" was not found', $this->logMessages);
$this->assertNotContains('The "block_content:6376f337-fcbf-4b28-b30e-ed5b6932e692" block plugin was not found', $this->logMessages);
// Ensure the expected message is generated when creating an instance of the
// block.
$instance = $this->container->get('plugin.manager.block')->createInstance($plugin_id);
$this->assertContains('The "block_content:6376f337-fcbf-4b28-b30e-ed5b6932e692" was not found', $this->logMessages);
$this->assertContains('The "block_content:6376f337-fcbf-4b28-b30e-ed5b6932e692" block plugin was not found', $this->logMessages);
$this->assertInstanceOf(Broken::class, $instance);
}

View File

@ -114,7 +114,7 @@ class BlockManagerTest extends UnitTestCase {
* @covers ::handlePluginNotFound
*/
public function testHandlePluginNotFound(): void {
$this->logger->warning('The "%plugin_id" was not found', ['%plugin_id' => 'invalid'])->shouldBeCalled();
$this->logger->warning('The "%plugin_id" block plugin was not found', ['%plugin_id' => 'invalid'])->shouldBeCalled();
$plugin = $this->blockManager->createInstance('invalid');
$this->assertSame('broken', $plugin->getPluginId());
}