class HoldTestHelper
Contains methods for testing hold request/response.
Hierarchy
- class \Drupal\hold_test\HoldTestHelper
Expanded class hierarchy of HoldTestHelper
3 files declare their use of HoldTestHelper
- hold_test.install in core/
modules/ system/ tests/ modules/ hold_test/ hold_test.install - MediaLibraryTestBase.php in core/
modules/ media_library/ tests/ src/ FunctionalJavascript/ MediaLibraryTestBase.php - ThrobberTest.php in core/
tests/ Drupal/ FunctionalJavascriptTests/ Ajax/ ThrobberTest.php
File
-
core/
modules/ system/ tests/ modules/ hold_test/ src/ HoldTestHelper.php, line 12
Namespace
Drupal\hold_testView source
class HoldTestHelper {
/**
* Request hold.
*
* @param bool $status
* TRUE - enable hold, FALSE - disable hold.
*/
public static function requestHold(bool $status) : void {
$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.
*/
public static function responseHold(bool $status) : void {
$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);
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
HoldTestHelper::requestHold | public static | function | Request hold. |
HoldTestHelper::responseHold | public static | function | Response hold. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.