function LoggerChannelTest::providerTestLog
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php \Drupal\Tests\Core\Logger\LoggerChannelTest::providerTestLog()
- 8.9.x core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php \Drupal\Tests\Core\Logger\LoggerChannelTest::providerTestLog()
- 11.x core/tests/Drupal/Tests/Core/Logger/LoggerChannelTest.php \Drupal\Tests\Core\Logger\LoggerChannelTest::providerTestLog()
Data provider for self::testLog().
File
-
core/
tests/ Drupal/ Tests/ Core/ Logger/ LoggerChannelTest.php, line 147
Class
- LoggerChannelTest
- @coversDefaultClass \Drupal\Core\Logger\LoggerChannel @group Logger
Namespace
Drupal\Tests\Core\LoggerCode
public static function providerTestLog() : \Generator {
// No request or account.
(yield [
function ($context) {
return $context['channel'] == 'test' && empty($context['uid']) && $context['ip'] === '';
},
FALSE,
FALSE,
]);
// With account but not request. Since the request is not available the
// current user should not be used.
(yield [
function ($context) {
return $context['uid'] === 0 && $context['ip'] === '';
},
FALSE,
TRUE,
]);
// With request but not account.
(yield [
function ($context) {
return $context['ip'] === '127.0.0.1' && empty($context['uid']);
},
TRUE,
FALSE,
]);
// Both request and account.
(yield [
function ($context) {
return $context['ip'] === '127.0.0.1' && $context['uid'] === 1;
},
TRUE,
TRUE,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.