class LegacyMessengerTest in Service Container 7
Same name in this branch
- 7 tests/src/Messenger/LegacyMessengerTest.php \Drupal\Tests\service_container\Messenger\LegacyMessengerTest
- 7 lib/Drupal/service_container/Tests/LegacyMessengerTest.php \Drupal\service_container\Tests\LegacyMessengerTest
Same name and namespace in other branches
- 7.2 lib/Drupal/service_container/Tests/LegacyMessengerTest.php \Drupal\service_container\Tests\LegacyMessengerTest
Hierarchy
- class \Drupal\service_container\Tests\ServiceContainerIntegrationTestBase extends \Drupal\service_container\Tests\DrupalWebTestCase
- class \Drupal\service_container\Tests\LegacyMessengerTest
Expanded class hierarchy of LegacyMessengerTest
File
- lib/
Drupal/ service_container/ Tests/ LegacyMessengerTest.php, line 12 - Contains \Drupal\service_container\Tests\LegacyMessengerTest.
Namespace
Drupal\service_container\TestsView source
class LegacyMessengerTest extends ServiceContainerIntegrationTestBase {
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'LegacyMessenger',
'description' => 'Tests the messenger integration',
'group' => 'service_container',
);
}
public function testLegacyMessenger() {
/** @var \Drupal\service_container\Messenger\LegacyMessenger $messenger_service */
$messenger_service = $this->container
->get('messenger');
$this
->assertTrue($messenger_service instanceof LegacyMessenger);
$random_message = $this
->randomString();
drupal_set_message($random_message, $messenger_service::WARNING);
$messages = $messenger_service
->getMessages();
$warning_messages = $messages[$messenger_service::WARNING];
$this
->assertTrue(in_array($random_message, $warning_messages));
$random_message = $this
->randomString();
$messenger_service
->addMessage($random_message, $messenger_service::STATUS);
$messages = drupal_get_messages();
$status_messages = $messages[$messenger_service::STATUS];
$this
->assertTrue(in_array($random_message, $status_messages));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LegacyMessengerTest:: |
public static | function | ||
LegacyMessengerTest:: |
public | function | ||
ServiceContainerIntegrationTestBase:: |
protected | property | The dependency injection container usable in the test. | |
ServiceContainerIntegrationTestBase:: |
protected | property | The profile to install as a basis for testing. | 1 |
ServiceContainerIntegrationTestBase:: |
protected | function | 5 |