hold_test.module

Same filename in other branches
  1. 8.9.x core/modules/system/tests/modules/hold_test/hold_test.module
  2. 10 core/modules/system/tests/modules/hold_test/hold_test.module
  3. 11.x core/modules/system/tests/modules/hold_test/hold_test.module

Contains functions for testing hold request/response.

File

core/modules/system/tests/modules/hold_test/hold_test.module

View source
<?php


/**
 * @file
 * Contains functions for testing hold request/response.
 */
use Drupal\hold_test\EventSubscriber\HoldTestSubscriber;

/**
 * Request hold.
 *
 * @param bool $status
 *   TRUE - enable hold, FALSE - disable hold.
 */
function hold_test_request($status) {
    $site_path = \Drupal::getContainer()->getParameter('site.path');
    file_put_contents($site_path . '/hold_test_request.txt', $status);
    // If we're releasing the hold wait for a bit to allow the subscriber to read
    // the file.
    if (!$status) {
        usleep(HoldTestSubscriber::WAIT * 2);
    }
}

/**
 * Response hold.
 *
 * @param bool $status
 *   TRUE - enable hold, FALSE - disable hold.
 */
function hold_test_response($status) {
    $site_path = \Drupal::getContainer()->getParameter('site.path');
    file_put_contents($site_path . '/hold_test_response.txt', $status);
    // If we're releasing the hold wait for a bit to allow the subscriber to read
    // the file.
    if (!$status) {
        usleep(HoldTestSubscriber::WAIT * 2);
    }
}

Functions

Title Deprecated Summary
hold_test_request Request hold.
hold_test_response Response hold.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.