UpdatePathTest.php in Entity Reference Hierarchy 3.x
File
modules/entity_hierarchy_workbench_access/tests/src/Functional/UpdatePathTest.php
View source
<?php
namespace Drupal\Tests\entity_hierarchy_workbench_access\Functional;
use Composer\Semver\Semver;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
class UpdatePathTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../fixtures/eh_wba-update-path-test.php.gz',
];
}
public function testUpdatePath() {
if (Semver::satisfies(\Drupal::VERSION, '~9')) {
$this
->markTestSkipped('This test is only for Drupal 8');
}
$expected_fields = \Drupal::config('workbench_access.settings')
->get('parents');
$expected_bundles = array_keys(\Drupal::config('workbench_access.settings')
->get('fields')['node']);
$this
->runUpdates();
$scheme = $this->container
->get('entity_type.manager')
->getStorage('access_scheme')
->load('default');
$config = $scheme
->getAccessScheme()
->getConfiguration();
$this
->assertEquals($expected_fields, $config['boolean_fields']);
$this
->assertEquals($expected_bundles, $config['bundles']);
$this
->drupalLogin($this->rootUser);
$this
->drupalGet($scheme
->toUrl('edit-form'));
$assert = $this
->assertSession();
$assert
->fieldExists('scheme_settings[bundles][page]');
$assert
->checkboxChecked('scheme_settings[bundles][page]');
}
}
Classes
Name |
Description |
UpdatePathTest |
Defines a class for testing the update path to scheme based access. |