Backup of db before drupal security update
[yaffs-website] / web / core / modules / views_ui / tests / src / Functional / StorageTest.php
1 <?php
2
3 namespace Drupal\Tests\views_ui\Functional;
4
5 use Drupal\language\Entity\ConfigurableLanguage;
6 use Drupal\views\Views;
7
8 /**
9  * Tests the UI of storage properties of views.
10  *
11  * @group views_ui
12  */
13 class StorageTest extends UITestBase {
14
15   /**
16    * Views used by this test.
17    *
18    * @var array
19    */
20   public static $testViews = ['test_view'];
21
22   /**
23    * Modules to enable.
24    *
25    * @var array
26    */
27   public static $modules = ['views_ui', 'language'];
28
29   /**
30    * Tests changing label, description and tag.
31    *
32    * @see views_ui_edit_details_form
33    */
34   public function testDetails() {
35     $view_name = 'test_view';
36
37     ConfigurableLanguage::createFromLangcode('fr')->save();
38
39     $edit = [
40       'label' => $this->randomMachineName(),
41       'tag' => $this->randomMachineName(),
42       'description' => $this->randomMachineName(30),
43       'langcode' => 'fr',
44     ];
45
46     $this->drupalPostForm("admin/structure/views/nojs/edit-details/$view_name/default", $edit, t('Apply'));
47     $this->drupalPostForm(NULL, [], t('Save'));
48
49     $view = Views::getView($view_name);
50
51     foreach (['label', 'tag', 'description', 'langcode'] as $property) {
52       $this->assertEqual($view->storage->get($property), $edit[$property], format_string('Make sure the property @property got probably saved.', ['@property' => $property]));
53     }
54   }
55
56 }