You are here

protected function ConfigStorageTest::insert in MongoDB 8

1 call to ConfigStorageTest::insert()
ConfigStorageTest::testCRUD in src/Tests/ConfigStorageTest.php
Overrides Drupal\config\Tests\Storage\ConfigStorageTestBase::testCRUD().

File

src/Tests/ConfigStorageTest.php, line 146
Definition of Drupal\mongodb\Tests\ConfigStorageTest.

Class

ConfigStorageTest
Tests ConfigStorage controller operations.

Namespace

Drupal\mongodb\Tests

Code

protected function insert($name, $data) {
  if (is_string($data)) {
    $data = Yaml::parse($data);
    if (!is_array($data)) {
      return;
    }
  }
  \Drupal::service('mongo')
    ->get('config.active')
    ->update(array(
    '_id' => $name,
  ), $data, array(
    'upsert' => TRUE,
  ));
}