Mercurial > hg > isophonics-drupal-site
view 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 |
line wrap: on
line source
<?php namespace Drupal\Tests\options\Functional; /** * Tests an options select with a dynamic allowed values function. * * @group options */ class OptionsSelectDynamicValuesTest extends OptionsDynamicValuesTestBase { /** * Tests the 'options_select' widget (single select). */ public function testSelectListDynamic() { // Create an entity. $this->entity->save(); // Create a web user. $web_user = $this->drupalCreateUser(['view test entity', 'administer entity_test content']); $this->drupalLogin($web_user); // Display form. $this->drupalGet('entity_test_rev/manage/' . $this->entity->id() . '/edit'); $options = $this->xpath('//select[@id="edit-test-options"]/option'); $this->assertEqual(count($options), count($this->test) + 1); foreach ($options as $option) { $value = (string) $option['value']; if ($value != '_none') { $this->assertTrue(array_search($value, $this->test)); } } } }