public function MonitoringServicesTest::testSensorCaching in Monitoring 8
Test sensor dynamic cacheability
File
- tests/
src/ Functional/ MonitoringServicesTest.php, line 92
Class
- MonitoringServicesTest
- Tests for monitoring services.
Namespace
Drupal\Tests\monitoring\FunctionalCode
public function testSensorCaching() {
$this
->drupalLogin($this->servicesAccount);
$sensor_name = 'dblog_event_severity_error';
$response_data = $this
->doJsonRequest('monitoring-sensor/' . $sensor_name);
$this
->assertResponse(200);
$sensor_config = SensorConfig::load($sensor_name);
$this
->assertEqual($response_data['label'], $sensor_config
->getLabel());
$sensor_config
->set('label', 'TestLabelForCaching');
$sensor_config
->save();
$response_data = $this
->doJsonRequest('monitoring-sensor/' . $sensor_name);
$this
->assertResponse(200);
$this
->assertEqual($response_data['label'], 'TestLabelForCaching');
}