You are here

public function OgDeleteOrphansTest::testDisabled in Organic groups 8

Tests that orphaned content is not deleted when the option is disabled.

@dataProvider ogDeleteOrphansPluginProvider

Parameters

string $plugin_id: The machine name of the plugin under test.

bool $run_cron: Whether or not cron jobs should be run as part of the test. Unused in this test.

bool $asynchronous: Whether or not the actual deletion of the orphans happens in an asynchronous operation (e.g. pressing the button that launches the batch process). Unused in this test.

string $queue_id: The ID of the queue that is used by the plugin under test.

File

tests/src/Kernel/OgDeleteOrphansTest.php, line 193

Class

OgDeleteOrphansTest
Tests deletion of orphaned group content and memberships.

Namespace

Drupal\Tests\og\Kernel

Code

public function testDisabled($plugin_id, $run_cron, $asynchronous, $queue_id) {

  // Disable deletion of orphans in the configuration and configure the chosen
  // plugin.
  $this
    ->config('og.settings')
    ->set('delete_orphans', FALSE)
    ->set('delete_orphans_plugin_id', $plugin_id)
    ->save();

  // Delete the group.
  $this->group
    ->delete();

  // Check that no orphans are queued for deletion.
  $this
    ->assertQueueCount($queue_id, 0);
}