function MonitoringApiTest::testSensorInfoPrecedence in Monitoring 7
Test sensor info hook precedence.
Test if custom sensor info hook implementation takes precedence from the local implementation.
We need to run this test as last as it includes a file that will result in other tests failures.
File
- test/
tests/ monitoring.api.test, line 413 - Contains \MonitoringApiTest.
Class
- MonitoringApiTest
- Tests for Monitoring API.
Code
function testSensorInfoPrecedence() {
// == Test monitoring sensor info. == //
$sensor_info = monitoring_sensor_info();
// The integration hook must be loaded.
$this
->assertTrue(isset($sensor_info['test_sensor_integration']));
// Include file with custom hook implementation.
require_once drupal_get_path('module', 'monitoring_test') . '/monitoring_test.custom_hook.inc';
monitoring_sensor_manager()
->resetCache();
// Reset the module implements cache.
module_implements(NULL, NULL, TRUE);
$sensor_info = monitoring_sensor_info();
// The custom hook must take precedence.
$this
->assertFalse(isset($sensor_info['test_sensor_integration']));
}