5b0ea2cb0132ca44e2e6ff246ef44966cf85bdb0
[yaffs-website] / web / modules / contrib / filefield_sources / src / Tests / ImceSourceTest.php
1 <?php
2
3 /**
4  * @file
5  * Definition of Drupal\filefield_sources\Tests\ClipboardSourceTest.
6  */
7
8 namespace Drupal\filefield_sources\Tests;
9
10 /**
11  * Tests the imce source.
12  *
13  * @group filefield_sources
14  */
15 class ImceSourceTest extends FileFieldSourcesTestBase {
16
17   /**
18    * Modules to enable.
19    *
20    * @var array
21    */
22   public static $modules = array('imce');
23
24   /**
25    * Sets up for imce source test case.
26    */
27   protected function setUp() {
28     parent::setUp();
29     $this->setUpImce();
30   }
31
32   /**
33    * Tests imce source enabled.
34    */
35   public function testImceSourceEnabled() {
36     $this->enableSources(array(
37       'imce' => TRUE,
38     ));
39     $file = $this->createPermanentFileEntity();
40
41     $this->uploadFileByImceSource($file->getFileUri(), $file->getFilename(), 0);
42
43     // We can only upload one file on single value field.
44     $this->assertNoFieldByXPath('//input[@type="submit"]', t('Select'), t('After uploading a file, "Select" button is no longer displayed.'));
45
46     $this->removeFile($file->getFilename(), 0);
47
48     // Can upload file again.
49     $this->assertFieldByXpath('//input[@type="submit"]', t('Select'), 'After clicking the "Remove" button, the "Select" button is displayed.');
50   }
51
52 }