Update to Drupal 8.0.3. For more information, see https://www.drupal.org/drupal-8.0.3-release-notes

This commit is contained in:
Pantheon Automation 2016-02-03 14:56:31 -08:00 committed by Greg Anderson
parent 10f9f7fbde
commit 9db4fae9a7
202 changed files with 3806 additions and 760 deletions

View file

@ -101,6 +101,10 @@ class LinkFieldTest extends WebTestBase {
// strings displayed to the user).
$valid_external_entries = array(
'http://www.example.com/' => 'http://www.example.com/',
// Strings within parenthesis without leading space char.
'http://www.example.com/strings_(string_within_parenthesis)' => 'http://www.example.com/strings_(string_within_parenthesis)',
// Numbers within parenthesis without leading space char.
'http://www.example.com/numbers_(9999)' => 'http://www.example.com/numbers_(9999)',
);
$valid_internal_entries = array(
'/entity_test/add' => '/entity_test/add',

View file

@ -0,0 +1,102 @@
<?php
/**
* @file
* Contains \Drupal\link\Tests\Views\LinkViewsTokensTest.
*/
namespace Drupal\link\Tests\Views;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
/**
* Tests the views integration for link tokens.
*
* @group link
*/
class LinkViewsTokensTest extends ViewTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['link_test_views'];
/**
* Views used by this test.
*
* @var array
*/
public static $testViews = ['test_link_tokens'];
/**
* The field name used for the link field.
*
* @var string
*/
protected $fieldName = 'field_link';
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
ViewTestData::createTestViews(get_class($this), array('link_test_views'));
// Create Basic page node type.
$this->drupalCreateContentType(array(
'type' => 'page',
'name' => 'Basic page'
));
// Create a field.
FieldStorageConfig::create(array(
'field_name' => $this->fieldName,
'type' => 'link',
'entity_type' => 'node',
'cardinality' => 1,
))->save();
FieldConfig::create(array(
'field_name' => $this->fieldName,
'entity_type' => 'node',
'bundle' => 'page',
'label' => 'link field',
))->save();
}
public function testLinkViewsTokens() {
// Array of URI's to test.
$uris = [
'http://www.drupal.org' => 'Drupal.org',
];
// Add nodes with the URI's and titles.
foreach ($uris as $uri => $title) {
$values = array('type' => 'page');
$values[$this->fieldName][] = ['uri' => $uri, 'title' => $title, 'options' => ['attributes' => ['class' => 'test-link-class']]];
$this->drupalCreateNode($values);
}
$this->drupalGet('test_link_tokens');
foreach ($uris as $uri => $title) {
// Formatted link: {{ field_link }}<br />
$this->assertRaw("Formated: <a href=\"$uri\" class=\"test-link-class\">$title</a>");
// Raw uri: {{ field_link__uri }}<br />
$this->assertRaw("Raw uri: $uri");
// Raw title: {{ field_link__title }}<br />
$this->assertRaw("Raw title: $title");
// Raw options: {{ field_link__options }}<br />
// Options is an array and should return empty after token replace.
$this->assertRaw("Raw options: .");
}
}
}