class ToolkitSetupFormTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php \Drupal\FunctionalTests\Image\ToolkitSetupFormTest
- 10 core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php \Drupal\FunctionalTests\Image\ToolkitSetupFormTest
- 8.9.x core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php \Drupal\FunctionalTests\Image\ToolkitSetupFormTest
Tests image toolkit setup form.
@group Image
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalTests\Image\ToolkitSetupFormTest implements \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of ToolkitSetupFormTest
File
-
core/
tests/ Drupal/ FunctionalTests/ Image/ ToolkitSetupFormTest.php, line 12
Namespace
Drupal\FunctionalTests\ImageView source
class ToolkitSetupFormTest extends BrowserTestBase {
/**
* Admin user account.
*
* @var \Drupal\user\Entity\User
*/
protected $adminUser;
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'system',
'image_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->adminUser = $this->drupalCreateUser([
'administer site configuration',
]);
$this->drupalLogin($this->adminUser);
}
/**
* Tests Image toolkit setup form.
*/
public function testToolkitSetupForm() {
// Get form.
$this->drupalGet('admin/config/media/image-toolkit');
// Test that default toolkit is GD.
$this->assertSession()
->fieldValueEquals('image_toolkit', 'gd');
// Test changing the jpeg image quality.
$edit = [
'gd[image_jpeg_quality]' => '70',
];
$this->submitForm($edit, 'Save configuration');
$this->assertEquals('70', $this->config('system.image.gd')
->get('jpeg_quality'));
// Test changing the toolkit.
$edit = [
'image_toolkit' => 'test',
];
$this->submitForm($edit, 'Save configuration');
$this->assertEquals('test', $this->config('system.image')
->get('toolkit'));
$this->assertSession()
->fieldValueEquals('test[test_parameter]', '10');
// Test changing the test toolkit parameter.
$edit = [
'test[test_parameter]' => '0',
];
$this->submitForm($edit, 'Save configuration');
$this->assertSession()
->pageTextContains('Test parameter should be different from 0.');
$edit = [
'test[test_parameter]' => '20',
];
$this->submitForm($edit, 'Save configuration');
$this->assertEquals('20', $this->config('system.image.test_toolkit')
->get('test_parameter'));
// Test access without the permission 'administer site configuration'.
$this->drupalLogin($this->drupalCreateUser([
'access administration pages',
]));
$this->drupalGet('admin/config/media/image-toolkit');
$this->assertSession()
->statusCodeEquals(403);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.