trait GridStackTestTrait in GridStack 8
Same name and namespace in other branches
- 8.2 tests/src/Traits/GridStackTestTrait.php \Drupal\Tests\gridstack\Traits\GridStackTestTrait
A Trait common for GridStack tests.
Hierarchy
- trait \Drupal\Tests\gridstack\Traits\GridStackTestTrait
File
- tests/
src/ Traits/ GridStackTestTrait.php, line 8
Namespace
Drupal\Tests\gridstack\TraitsView source
trait GridStackTestTrait {
/**
* Verifies the logged in user has access to the various pages.
*
* @param array $pages
* The array of pages we want to test.
* @param int $response
* (optional) An HTTP response code. Defaults to 200.
*/
protected function verifyPages(array $pages = [], $response = 200) {
foreach ($pages as $page) {
$this
->drupalGet($page);
$this
->assertSession()
->statusCodeEquals($response);
}
}
/**
* Wraps the submit form.
*
* @param string $page
* The page we want to test.
* @param array $content
* The content to submit.
* @param string $submit
* The submit text.
* @param int $response
* (optional) An HTTP response code. Defaults to 200.
* @param string $message
* The message text.
*/
protected function verifySubmitForm($page = '', array $content = [], $submit = 'Save', $response = 200, $message = '') {
$this
->drupalGet($page);
$this
->submitForm($content, $submit);
$this
->assertResponse($response, $message);
}
/**
* Update a blazy setting.
*
* @param string $setting
* The name of the setting.
* @param string $value
* The value.
* @param string $config
* The config.
*/
protected function updateConfig($setting, $value, $config = 'blazy.settings') {
\Drupal::configFactory()
->getEditable($config)
->set($setting, $value)
->save();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GridStackTestTrait:: |
protected | function | Update a blazy setting. | |
GridStackTestTrait:: |
protected | function | Verifies the logged in user has access to the various pages. | |
GridStackTestTrait:: |
protected | function | Wraps the submit form. |