This repository has been archived on 2025-01-19. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
drupalcampbristol/core/modules/options/src/Tests/OptionsSelectDynamicValuesTest.php

39 lines
1 KiB
PHP
Raw Normal View History

<?php
/**
* @file
* Contains \Drupal\options\Tests\OptionsSelectDynamicValuesTest.
*/
namespace Drupal\options\Tests;
/**
* Tests an options select with a dynamic allowed values function.
*
* @group options
*/
class OptionsSelectDynamicValuesTest extends OptionsDynamicValuesTestBase {
/**
* Tests the 'options_select' widget (single select).
*/
function testSelectListDynamic() {
// Create an entity.
$this->entity->save();
// Create a web user.
$web_user = $this->drupalCreateUser(array('view test entity', 'administer entity_test content'));
$this->drupalLogin($web_user);
// Display form.
$this->drupalGet('entity_test_rev/manage/' . $this->entity->id());
$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));
}
}
}
}