Same filename and directory in other branches
- 8.9.x core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php
- 9 core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php
Namespace
Drupal\Tests\system\Functional\Condition
File
core/modules/system/tests/src/Functional/Condition/ConditionFormTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\system\Functional\Condition;
use Drupal\node\Entity\Node;
use Drupal\Tests\BrowserTestBase;
class ConditionFormTest extends BrowserTestBase {
protected static $modules = [
'node',
'condition_test',
];
protected $defaultTheme = 'stark';
public function testConfigForm() {
$this
->drupalCreateContentType([
'type' => 'page',
'name' => 'Page',
]);
$this
->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
]);
$article = Node::create([
'type' => 'article',
'title' => $this
->randomMachineName(),
]);
$article
->save();
$this
->drupalGet('condition_test');
$this
->assertSession()
->fieldExists('entity_bundle[bundles][article]');
$this
->assertSession()
->fieldExists('entity_bundle[bundles][page]');
$this
->submitForm([
'entity_bundle[bundles][page]' => 'page',
'entity_bundle[bundles][article]' => 'article',
], 'Submit');
$this
->assertSession()
->pageTextContains('Bundle: page');
$this
->assertSession()
->pageTextContains('Bundle: article');
$this
->assertSession()
->pageTextContains('Executed successfully.');
$this
->assertSession()
->pageTextContains('The current theme is stark');
$theme_installer = $this->container
->get('theme_installer');
$theme_installer
->install([
'olivero',
]);
$this
->drupalGet('condition_test');
$this
->submitForm([
'current_theme[theme]' => 'olivero',
'current_theme[negate]' => TRUE,
], 'Submit');
$this
->assertSession()
->pageTextContains('The current theme is not olivero');
}
}
Classes