$logger->
info('Cron run completed.'
)->
shouldBeCalled();
// Set a flag to track when a message is logged by adding a callback
// function for each logging method.
foreach (get_class_methods(LoggerInterface::
class) as $logger_method) { $logger->
{$logger_method}(Argument::
cetera())->
will(function D
) { \Drupal::
state()->
set('cron_test.message_logged', TRUE
);
});
} // Create a logger factory to produce the resulting logger.
$logger_factory =
$this->
prophesize('Drupal\Core\Logger\LoggerChannelFactoryInterface'
);
$logger_factory->
get(Argument::
exact('cron'
))->
willReturn($logger->
reveal());
// Create a mock time service.
$time =
$this->
prophesize('Drupal\Component\Datetime\TimeInterface'
);
// Create a mock config factory and config object.
$config_factory =
$this->
prophesize(ConfigFactoryInterface::
class);
$config =
$this->
prophesize(ImmutableConfig::
class);
$config->
get('logging'
)->
willReturn(FALSE
);
$config_factory->
get('system.cron'
)->
willReturn($config->
reveal());
// Build the container using the resulting mock objects.