How to debug a configuration object, when testing? I write tests for a custom module using Drupal\simpletest\WebTestBase. I can not find a method, how to debug the configuration object.

I tried e.g. the following commands:

$config = \Drupal::config('mymodule.settings');

debug($config); // AJAX-HTTP-Error
debug(get_object_vars($config)); // Empty array
debug($config-&gt;getRawData()); // Empty array
debug($config-&gt;getOriginal()); // Empty array
dump($config); // AJAX-HTTP-Error
var_dump($config); // Needs extremely long time
ksm($config); // Nothing is shown
kint($config); // Nothing is shown
dpm($config); // ServiceNotFoundException
dpm($config-&gt;toArray()); // AJAX-HTTP-Error
dsm(get_object_vars($config)); // ServiceNotFoundException
print_r($config); // Needs extremely long time


The debug() command works fine for arrays and strings (and is nice integrated in the test report).

 debug($var, 'Label');
You can use Config::get(), for which:


  If no key is specified, then the entire data array is returned.


e.g.

debug(\Drupal::config('mymodule.settings')-&gt;get());