Mercurial > hg > isophonics-drupal-site
comparison core/modules/options/tests/src/Functional/OptionsSelectDynamicValuesTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Tests\options\Functional; | |
4 | |
5 /** | |
6 * Tests an options select with a dynamic allowed values function. | |
7 * | |
8 * @group options | |
9 */ | |
10 class OptionsSelectDynamicValuesTest extends OptionsDynamicValuesTestBase { | |
11 /** | |
12 * Tests the 'options_select' widget (single select). | |
13 */ | |
14 public function testSelectListDynamic() { | |
15 // Create an entity. | |
16 $this->entity->save(); | |
17 | |
18 // Create a web user. | |
19 $web_user = $this->drupalCreateUser(['view test entity', 'administer entity_test content']); | |
20 $this->drupalLogin($web_user); | |
21 | |
22 // Display form. | |
23 $this->drupalGet('entity_test_rev/manage/' . $this->entity->id() . '/edit'); | |
24 $options = $this->xpath('//select[@id="edit-test-options"]/option'); | |
25 $this->assertEqual(count($options), count($this->test) + 1); | |
26 foreach ($options as $option) { | |
27 $value = (string) $option['value']; | |
28 if ($value != '_none') { | |
29 $this->assertTrue(array_search($value, $this->test)); | |
30 } | |
31 } | |
32 } | |
33 | |
34 } |