updated core to 8.6.3
This commit is contained in:
@@ -576,7 +576,7 @@ class BrowserTestBaseTest extends BrowserTestBase {
|
||||
$this->assertFieldChecked('edit-checkbox-enabled');
|
||||
$this->assertNoFieldChecked('edit-checkbox-disabled');
|
||||
|
||||
// Test that the assertion fails correctly with non-existant field id.
|
||||
// Test that the assertion fails correctly with non-existent field id.
|
||||
try {
|
||||
$this->assertNoFieldChecked('incorrect_checkbox_id');
|
||||
$this->fail('The "incorrect_checkbox_id" field was found');
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\FunctionalTests\Datetime;
|
||||
|
||||
use Drupal\Core\Entity\Entity\EntityFormDisplay;
|
||||
use Drupal\Core\Entity\Entity\EntityViewDisplay;
|
||||
use Drupal\field\Entity\FieldConfig;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
/**
|
||||
* Tests the functionality of TimestampAgoFormatter core field formatter.
|
||||
*
|
||||
* @group field
|
||||
*/
|
||||
class TimestampAgoFormatterTest extends BrowserTestBase {
|
||||
|
||||
/**
|
||||
* An array of display options to pass to entity_get_display().
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $displayOptions;
|
||||
|
||||
/**
|
||||
* A field storage to use in this test class.
|
||||
*
|
||||
* @var \Drupal\field\Entity\FieldStorageConfig
|
||||
*/
|
||||
protected $fieldStorage;
|
||||
|
||||
/**
|
||||
* The field used in this test class.
|
||||
*
|
||||
* @var \Drupal\field\Entity\FieldConfig
|
||||
*/
|
||||
protected $field;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['entity_test', 'field_ui'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$web_user = $this->drupalCreateUser([
|
||||
'access administration pages',
|
||||
'view test entity',
|
||||
'administer entity_test content',
|
||||
'administer entity_test fields',
|
||||
'administer entity_test display',
|
||||
'administer entity_test form display',
|
||||
'view the administration theme',
|
||||
]);
|
||||
$this->drupalLogin($web_user);
|
||||
|
||||
$field_name = 'field_timestamp';
|
||||
$type = 'timestamp';
|
||||
$widget_type = 'datetime_timestamp';
|
||||
$formatter_type = 'timestamp_ago';
|
||||
|
||||
$this->fieldStorage = FieldStorageConfig::create([
|
||||
'field_name' => $field_name,
|
||||
'entity_type' => 'entity_test',
|
||||
'type' => $type,
|
||||
]);
|
||||
$this->fieldStorage->save();
|
||||
$this->field = FieldConfig::create([
|
||||
'field_storage' => $this->fieldStorage,
|
||||
'bundle' => 'entity_test',
|
||||
'required' => TRUE,
|
||||
]);
|
||||
$this->field->save();
|
||||
|
||||
EntityFormDisplay::load('entity_test.entity_test.default')
|
||||
->setComponent($field_name, ['type' => $widget_type])
|
||||
->save();
|
||||
|
||||
$this->displayOptions = [
|
||||
'type' => $formatter_type,
|
||||
'label' => 'hidden',
|
||||
];
|
||||
|
||||
EntityViewDisplay::create([
|
||||
'targetEntityType' => $this->field->getTargetEntityTypeId(),
|
||||
'bundle' => $this->field->getTargetBundle(),
|
||||
'mode' => 'full',
|
||||
'status' => TRUE,
|
||||
])->setComponent($field_name, $this->displayOptions)
|
||||
->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the formatter settings.
|
||||
*/
|
||||
public function testSettings() {
|
||||
$this->drupalGet('entity_test/structure/entity_test/display');
|
||||
|
||||
$edit = [
|
||||
'fields[field_timestamp][region]' => 'content',
|
||||
'fields[field_timestamp][type]' => 'timestamp_ago',
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
|
||||
$this->drupalPostForm(NULL, [], 'field_timestamp_settings_edit');
|
||||
$edit = [
|
||||
'fields[field_timestamp][settings_edit_form][settings][future_format]' => 'ends in @interval',
|
||||
'fields[field_timestamp][settings_edit_form][settings][past_format]' => 'started @interval ago',
|
||||
'fields[field_timestamp][settings_edit_form][settings][granularity]' => 3,
|
||||
];
|
||||
$this->drupalPostForm(NULL, $edit, 'Update');
|
||||
$this->drupalPostForm(NULL, [], 'Save');
|
||||
|
||||
$this->assertSession()->pageTextContains('ends in 1 year 1 month 1 week');
|
||||
$this->assertSession()->pageTextContains('started 1 year 1 month 1 week ago');
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -69,7 +69,7 @@ class InstallerExistingSettingsMismatchProfileTest extends InstallerTestBase {
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUpLanguage() {
|
||||
// This step is skipped, because there is a lagcode as a query param.
|
||||
// This step is skipped, because there is a langcode as a query param.
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\FunctionalTests\Installer;
|
||||
|
||||
/**
|
||||
* Tests that an install profile can implement hook_requirements().
|
||||
*
|
||||
* @group Installer
|
||||
*/
|
||||
class InstallerProfileRequirementsTest extends InstallerTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $profile = 'testing_requirements';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUpSettings() {
|
||||
// This form will never be reached.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUpSite() {
|
||||
// This form will never be reached.
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the profile failed hook_requirements().
|
||||
*/
|
||||
public function testHookRequirementsFailure() {
|
||||
$this->assertSession()->pageTextContains('Testing requirements failed requirements.');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,14 +2,9 @@
|
||||
|
||||
namespace Drupal\FunctionalTests\Update;
|
||||
|
||||
use Behat\Mink\Driver\GoutteDriver;
|
||||
use Behat\Mink\Mink;
|
||||
use Behat\Mink\Selector\SelectorsHandler;
|
||||
use Behat\Mink\Session;
|
||||
use Drupal\Component\Utility\Crypt;
|
||||
use Drupal\Core\Test\TestRunnerKernel;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
use Drupal\Tests\HiddenFieldSelector;
|
||||
use Drupal\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\Core\DependencyInjection\ContainerBuilder;
|
||||
@@ -197,14 +192,7 @@ abstract class UpdatePathTestBase extends BrowserTestBase {
|
||||
require_once $this->root . '/core/includes/update.inc';
|
||||
|
||||
// Setup Mink.
|
||||
$session = $this->initMink();
|
||||
|
||||
$cookies = $this->extractCookiesFromRequest(\Drupal::request());
|
||||
foreach ($cookies as $cookie_name => $values) {
|
||||
foreach ($values as $value) {
|
||||
$session->setCookie($cookie_name, $value);
|
||||
}
|
||||
}
|
||||
$this->initMink();
|
||||
|
||||
// Set up the browser test output file.
|
||||
$this->initBrowserOutputFile();
|
||||
@@ -244,37 +232,8 @@ abstract class UpdatePathTestBase extends BrowserTestBase {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function initMink() {
|
||||
$driver = $this->getDefaultDriverInstance();
|
||||
|
||||
if ($driver instanceof GoutteDriver) {
|
||||
// Turn off curl timeout. Having a timeout is not a problem in a normal
|
||||
// test running, but it is a problem when debugging. Also, disable SSL
|
||||
// peer verification so that testing under HTTPS always works.
|
||||
/** @var \GuzzleHttp\Client $client */
|
||||
$client = $this->container->get('http_client_factory')->fromOptions([
|
||||
'timeout' => NULL,
|
||||
'verify' => FALSE,
|
||||
]);
|
||||
|
||||
// Inject a Guzzle middleware to generate debug output for every request
|
||||
// performed in the test.
|
||||
$handler_stack = $client->getConfig('handler');
|
||||
$handler_stack->push($this->getResponseLogHandler());
|
||||
|
||||
$driver->getClient()->setClient($client);
|
||||
}
|
||||
|
||||
$selectors_handler = new SelectorsHandler([
|
||||
'hidden_field_selector' => new HiddenFieldSelector(),
|
||||
]);
|
||||
$session = new Session($driver, $selectors_handler);
|
||||
$this->mink = new Mink();
|
||||
$this->mink->registerSession('default', $session);
|
||||
$this->mink->setDefaultSessionName('default');
|
||||
$this->registerSessions();
|
||||
|
||||
return $session;
|
||||
protected function initFrontPage() {
|
||||
// Do nothing as Drupal is not installed yet.
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,7 +296,10 @@ abstract class UpdatePathTestBase extends BrowserTestBase {
|
||||
|
||||
// Ensure there are no failed updates.
|
||||
if ($this->checkFailedUpdates) {
|
||||
$this->assertNoRaw('<strong>' . t('Failed:') . '</strong>');
|
||||
$failure = $this->cssSelect('.failure');
|
||||
if ($failure) {
|
||||
$this->fail('The update failed with the following message: "' . reset($failure)->getText() . '"');
|
||||
}
|
||||
|
||||
// Ensure that there are no pending updates.
|
||||
foreach (['update', 'post_update'] as $update_type) {
|
||||
|
||||
Reference in New Issue
Block a user