protected function GTMBaseTestCase::saveContainers in GoogleTagManager 7.2
Save containers in the database and create snippet files.
1 call to GTMBaseTestCase::saveContainers()
- GTMBaseTestCase::testModule in tests/
google_tag.base.test - Test the module.
File
- tests/
google_tag.base.test, line 103
Class
- GTMBaseTestCase
- Tests the Google Tag Manager.
Code
protected function saveContainers() {
foreach ($this->variables as $key => $variables) {
$export = new GTMContainerExport();
$default = $export
->default_container();
unset($default->data, $default->export_type, $default->type);
array_walk($variables, function ($value, $key) use ($default) {
$default->{$key} = $value;
});
// Save container.
$container = new GTMContainer((array) $default);
$container
->save(NULL);
// Create snippet files.
$manager = \GTMContainerManager::getInstance();
$manager
->createAssets($container);
}
}