summaryrefslogtreecommitdiffstats
path: root/core/modules/block/tests/modules/block_test
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/block/tests/modules/block_test')
-rw-r--r--core/modules/block/tests/modules/block_test/src/Controller/TestMultipleFormController.php5
-rw-r--r--core/modules/block/tests/modules/block_test/src/Form/FavoriteAnimalTestForm.php2
-rw-r--r--core/modules/block/tests/modules/block_test/src/Form/TestForm.php2
-rw-r--r--core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php5
4 files changed, 9 insertions, 5 deletions
diff --git a/core/modules/block/tests/modules/block_test/src/Controller/TestMultipleFormController.php b/core/modules/block/tests/modules/block_test/src/Controller/TestMultipleFormController.php
index e7aac65..246bcea 100644
--- a/core/modules/block/tests/modules/block_test/src/Controller/TestMultipleFormController.php
+++ b/core/modules/block/tests/modules/block_test/src/Controller/TestMultipleFormController.php
@@ -17,7 +17,8 @@ class TestMultipleFormController extends ControllerBase {
'form2' => $this->formBuilder()->buildForm('\Drupal\block_test\Form\FavoriteAnimalTestForm', $form_state),
];
- // Output all attached placeholders trough drupal_set_message(), so we can
+ // Output all attached placeholders trough
+ // \Drupal\Core\Messenger\MessengerInterface::addMessage(), so we can
// see if there's only one in the tests.
$post_render_callable = function ($elements) {
$matches = [];
@@ -26,7 +27,7 @@ class TestMultipleFormController extends ControllerBase {
$action_values = $matches[2];
foreach ($action_values as $action_value) {
- drupal_set_message('Form action: ' . $action_value);
+ $this->messenger()->addStatus('Form action: ' . $action_value);
}
return $elements;
};
diff --git a/core/modules/block/tests/modules/block_test/src/Form/FavoriteAnimalTestForm.php b/core/modules/block/tests/modules/block_test/src/Form/FavoriteAnimalTestForm.php
index 3ad55ed..a86db68 100644
--- a/core/modules/block/tests/modules/block_test/src/Form/FavoriteAnimalTestForm.php
+++ b/core/modules/block/tests/modules/block_test/src/Form/FavoriteAnimalTestForm.php
@@ -40,7 +40,7 @@ class FavoriteAnimalTestForm extends FormBase {
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
- drupal_set_message($this->t('Your favorite animal is: @favorite_animal', ['@favorite_animal' => $form['favorite_animal']['#value']]));
+ $this->messenger()->addStatus($this->t('Your favorite animal is: @favorite_animal', ['@favorite_animal' => $form['favorite_animal']['#value']]));
}
}
diff --git a/core/modules/block/tests/modules/block_test/src/Form/TestForm.php b/core/modules/block/tests/modules/block_test/src/Form/TestForm.php
index 7fa645d..7619d84 100644
--- a/core/modules/block/tests/modules/block_test/src/Form/TestForm.php
+++ b/core/modules/block/tests/modules/block_test/src/Form/TestForm.php
@@ -49,7 +49,7 @@ class TestForm extends FormBase {
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
- drupal_set_message($this->t('Your email address is @email', ['@email' => $form['email']['#value']]));
+ $this->messenger()->addStatus($this->t('Your email address is @email', ['@email' => $form['email']['#value']]));
}
}
diff --git a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php
index 7db350d..70afd54 100644
--- a/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php
+++ b/core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php
@@ -3,6 +3,7 @@
namespace Drupal\block_test\Plugin\Block;
use Drupal\Core\Block\BlockBase;
+use Drupal\Core\Messenger\MessengerTrait;
use Drupal\Core\Session\AccountInterface;
use Drupal\user\UserInterface;
@@ -19,6 +20,8 @@ use Drupal\user\UserInterface;
*/
class TestContextAwareBlock extends BlockBase {
+ use MessengerTrait;
+
/**
* {@inheritdoc}
*/
@@ -37,7 +40,7 @@ class TestContextAwareBlock extends BlockBase {
*/
protected function blockAccess(AccountInterface $account) {
if ($this->getContextValue('user') instanceof UserInterface) {
- drupal_set_message('User context found.');
+ $this->messenger()->addStatus('User context found.');
}
return parent::blockAccess($account);