3 namespace Drupal\entity_browser\Tests;
5 use Drupal\simpletest\WebTestBase;
8 * Tests the multistep display selection display.
10 * @group entity_browser
12 class MultistepDisplayTest extends WebTestBase {
19 public static $modules = ['entity_browser', 'ctools', 'block', 'node', 'file'];
24 protected function setUp() {
26 $this->drupalPlaceBlock('local_actions_block');
30 * Tests multistep display.
32 public function testMultistepDisplay() {
33 $account = $this->drupalCreateUser([
34 'administer entity browsers',
36 $this->drupalLogin($account);
37 $this->drupalGet('/admin/config/content/entity_browser');
38 $this->clickLink('Add Entity browser');
40 'label' => 'Test entity browser',
41 'id' => 'test_entity_browser',
42 'display' => 'iframe',
43 'widget_selector' => 'tabs',
44 'selection_display' => 'multi_step_display',
46 $this->drupalPostForm(NULL, $edit, 'Next');
47 $this->drupalPostForm(NULL, [], 'Next');
48 $this->drupalPostForm(NULL, [], 'Next');
50 $this->assertText('Selection display', 'Trail is shown.');
51 $this->assertText('Select button text', 'Title is correct.');
52 $this->assertText('Text to display on the entity browser select button.', 'Description is correct.');
53 $this->assertRaw('Use selected', 'Default text is correct.');
55 'entity_type' => 'file',
57 'selection_hidden' => 0,
58 'select_text' => 'Use blah selected',
60 $this->drupalPostForm(NULL, $edit, 'Next');
61 $this->drupalPostAjaxForm(NULL, ['widget' => 'upload'], 'widget');
62 $this->drupalPostForm(NULL, [], 'Finish');
64 $account = $this->drupalCreateUser([
65 'access test_entity_browser entity browser pages',
67 $this->drupalLogin($account);
68 // Go to the entity browser iframe link.
69 $this->drupalGet('/entity-browser/iframe/test_entity_browser');
70 $this->assertNoRaw('Use blah selected');
72 $image = current($this->drupalGetTestFiles('image'));
74 'files[upload][]' => $this->container->get('file_system')->realpath($image->uri),
76 $this->drupalPostForm(NULL, $edit, 'Select files');
77 $this->assertRaw('Use blah selected', 'Select button is displayed if something is selected.');