assertDatabaseCounts example

'access content',
      'access site reports',
      'administer site configuration',
    ]);
    $this->drupalLogin($user);

    // Set up the search plugin.     $this->plugin = $this->container->get('plugin.manager.search')->createInstance('node_search');

    // Check indexing counts before adding any nodes.     $this->assertIndexCounts(0, 0, 'before adding nodes');
    $this->assertDatabaseCounts(0, 0, 'before adding nodes');

    // Add two new languages.     ConfigurableLanguage::createFromLangcode('hu')->save();
    ConfigurableLanguage::createFromLangcode('sv')->save();

    // Make the body field translatable. The title is already translatable by     // definition. The parent class has already created the article and page     // content types.     $field_storage = FieldStorageConfig::loadByName('node', 'body');
    $field_storage->setTranslatable(TRUE);
    $field_storage->save();

    
Home | Imprint | This part of the site doesn't use cookies.