Update to Drupal 8.1.1. For more information, see https://www.drupal.org/node/2718713

This commit is contained in:
Pantheon Automation 2016-05-04 14:35:41 -07:00 committed by Greg Anderson
parent c0a0d5a94c
commit 9eae24d844
669 changed files with 3873 additions and 1553 deletions

View file

@ -324,7 +324,7 @@ class DbUpdateController extends ControllerBase {
$text = $this->t('This update will been skipped due to the following missing dependencies:') . '<em>' . implode(', ', $data['missing_dependencies']) . '</em>';
}
else {
$text = $this->t("This update will be skipped due to an error in the module's code.");
$text = $this->t("This update will be skipped due to an error in the module's code.");
}
$build['start'][$module_update_key]['#items'][$data['number']] .= '<div class="warning">' . $text . '</div>';
}
@ -374,6 +374,7 @@ class DbUpdateController extends ControllerBase {
'#attributes' => array('class' => array('button', 'button--primary')),
'#weight' => 5,
'#url' => $url,
'#access' => $url->access($this->currentUser()),
);
}

View file

@ -91,7 +91,7 @@ abstract class DateFormatFormBase extends EntityForm {
'#default_value' => $this->entity->id(),
'#machine_name' => array(
'exists' => array($this, 'exists'),
'replace_pattern' =>'([^a-z0-9_]+)|(^custom$)',
'replace_pattern' => '([^a-z0-9_]+)|(^custom$)',
'error' => $this->t('The machine-readable name must be unique, and can only contain lowercase letters, numbers, and underscores. Additionally, it can not be the reserved word "custom".'),
),
);

View file

@ -216,7 +216,7 @@ class ModulesListForm extends FormBase {
'#type' => 'link',
'#title' => $this->t('Help'),
'#url' => Url::fromRoute('help.page', ['name' => $module->getName()]),
'#options' => array('attributes' => array('class' => array('module-link', 'module-link-help'), 'title' => $this->t('Help'))),
'#options' => array('attributes' => array('class' => array('module-link', 'module-link-help'), 'title' => $this->t('Help'))),
);
}

View file

@ -143,7 +143,7 @@ class ModulesUninstallConfirmForm extends ConfirmFormBase {
);
// List the dependent entities.
$this->addDependencyListsToForm($form, 'module', $this->modules , $this->configManager, $this->entityManager);
$this->addDependencyListsToForm($form, 'module', $this->modules, $this->configManager, $this->entityManager);
return parent::buildForm($form, $form_state);
}

View file

@ -182,7 +182,7 @@ class ModulesUninstallForm extends FormBase {
$account = $this->currentUser()->id();
// Store the values for 6 hours. This expiration time is also used in
// the form cache.
$this->keyValueExpirable->setWithExpire($account, $uninstall, 6*60*60);
$this->keyValueExpirable->setWithExpire($account, $uninstall, 6 * 60 * 60);
// Redirect to the confirm form.
$form_state->setRedirect('system.modules_uninstall_confirm');

View file

@ -109,7 +109,7 @@ class RegionalForm extends ConfigFormBase {
'#default_value' => $configurable_timezones,
);
$form['timezone']['configurable_timezones_wrapper'] = array(
$form['timezone']['configurable_timezones_wrapper'] = array(
'#type' => 'container',
'#states' => array(
// Hide the user configured timezone settings when users are forced to use

View file

@ -136,9 +136,9 @@ class PathBasedBreadcrumbBuilder implements BreadcrumbBuilderInterface {
// /user is just a redirect, so skip it.
// @todo Find a better way to deal with /user.
$exclude['/user'] = TRUE;
// Because this breadcrumb builder is entirely path-based, vary by the
// 'url.path' cache context.
$breadcrumb->addCacheContexts(['url.path']);
// Add the url.path.parent cache context. This code ignores the last path
// part so the result only depends on the path parents.
$breadcrumb->addCacheContexts(['url.path.parent']);
while (count($path_elements) > 1) {
array_pop($path_elements);
// Copy the path elements for up-casting.

View file

@ -147,7 +147,9 @@ class RequestPath extends ConditionPluginBase implements ContainerFactoryPluginI
$request = $this->requestStack->getCurrentRequest();
// Compare the lowercase path alias (if any) and internal path.
$path = rtrim($this->currentPath->getPath($request), '/');
$path = $this->currentPath->getPath($request);
// Do not trim a trailing slash if that is the complete path.
$path = $path === '/' ? $path : rtrim($path, '/');
$path_alias = Unicode::strtolower($this->aliasManager->getAliasByPath($path));
return $this->pathMatcher->matchPath($path_alias, $pages) || (($path != $path_alias) && $this->pathMatcher->matchPath($path, $pages));

View file

@ -2,6 +2,7 @@
namespace Drupal\system\Tests\Ajax;
use Drupal\ajax_test\Controller\AjaxTestController;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\Core\Form\FormBuilderInterface;
use Drupal\Core\Url;
@ -29,7 +30,7 @@ class DialogTest extends AjaxTestBase {
$this->drupalGet('ajax-test/dialog');
// Set up variables for this test.
$dialog_renderable = \Drupal\ajax_test\Controller\AjaxTestController::dialogContents();
$dialog_renderable = AjaxTestController::dialogContents();
$dialog_contents = \Drupal::service('renderer')->renderRoot($dialog_renderable);
$modal_expected_response = array(
'command' => 'openDialog',

View file

@ -43,7 +43,7 @@ class MultiFormTest extends AjaxTestBase {
->setComponent($field_name, array('type' => 'text_textfield'))
->save();
// Login a user who can create 'page' nodes.
// Log in a user who can create 'page' nodes.
$this->drupalLogin ($this->drupalCreateUser(array('create page content')));
}
@ -88,7 +88,7 @@ class MultiFormTest extends AjaxTestBase {
$form = $this->xpath($form_xpath)[$offset];
$field = $form->xpath('.' . $field_xpath);
$this->assertEqual(count($field[0]->xpath('.' . $field_items_xpath_suffix)), $i+2, 'Found the correct number of field items after an AJAX submission.');
$this->assertEqual(count($field[0]->xpath('.' . $field_items_xpath_suffix)), $i + 2, 'Found the correct number of field items after an AJAX submission.');
$this->assertFieldsByValue($field[0]->xpath('.' . $button_xpath_suffix), NULL, 'Found the "add more" button after an AJAX submission.');
$this->assertNoDuplicateIds(t('Updated page contains unique IDs'), 'Other');
}

View file

@ -4,7 +4,7 @@ namespace Drupal\system\Tests\Asset;
use Drupal\Core\Asset\Exception\InvalidLibrariesExtendSpecificationException;
use Drupal\Core\Asset\Exception\InvalidLibrariesOverrideSpecificationException;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests the library discovery and library discovery parser.

View file

@ -89,7 +89,7 @@ abstract class GenericCacheBackendUnitTestBase extends KernelTestBase {
* @return \Drupal\Core\Cache\CacheBackendInterface
* Cache backend to test.
*/
protected function getCacheBackend($bin = null) {
protected function getCacheBackend($bin = NULL) {
if (!isset($bin)) {
$bin = $this->getTestBin();
}

View file

@ -280,7 +280,7 @@ class AttachedAssetsTest extends KernelTestBase {
$js_render_array = \Drupal::service('asset.js.collection_renderer')->render($js);
$rendered_js = $this->renderer->renderPlain($js_render_array);
$this->assertTrue(strpos($rendered_js, 'core/assets/vendor/backbone/backbone-min.js?v=1.2.3') > 0 && strpos($rendered_js, 'core/assets/vendor/domready/ready.min.js?v=1.0.8') > 0 , 'JavaScript version identifiers correctly appended to URLs');
$this->assertTrue(strpos($rendered_js, 'core/assets/vendor/backbone/backbone-min.js?v=1.2.3') > 0 && strpos($rendered_js, 'core/assets/vendor/domready/ready.min.js?v=1.0.8') > 0, 'JavaScript version identifiers correctly appended to URLs');
}
/**

View file

@ -31,7 +31,7 @@ class RenderWebTest extends WebTestBase {
$this->assertTitle('Test active link class | Drupal');
$this->assertCacheContext('url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT);
$this->drupalGet('common-test/type-link-active-class', ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'json']]);
$this->drupalGet('common-test/type-link-active-class', ['query' => [MainContentViewSubscriber::WRAPPER_FORMAT => 'json']]);
$this->assertIdentical('application/json', $this->drupalGetHeader('Content-Type'));
$json = Json::decode($this->getRawContent());
$this->assertEqual(['content', 'title'], array_keys($json));
@ -127,7 +127,7 @@ class RenderWebTest extends WebTestBase {
),
);
$this->assertRenderedElement($element, '//a[@href=:href and contains(., :title)]', array(
':href' => URL::fromRoute('common_test.destination')->setAbsolute()->toString(),
':href' => URL::fromRoute('common_test.destination')->setAbsolute()->toString(),
':title' => $element['#title'],
));

View file

@ -327,7 +327,7 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase {
$referencing_entity_url = $this->referencingEntity->urlInfo('canonical');
$non_referencing_entity_url = $this->nonReferencingEntity->urlInfo('canonical');
$listing_url = Url::fromRoute('entity.entity_test.collection_referencing_entities', [
'entity_reference_field_name' => $entity_type . '_reference',
'entity_reference_field_name' => $entity_type . '_reference',
'referenced_entity_type' => $entity_type,
'referenced_entity_id' => $this->entity->id(),
]);
@ -346,7 +346,7 @@ abstract class EntityCacheTagsTestBase extends PageCacheTagsTestBase {
$page_cache_tags = Cache::mergeTags(['rendered'], ['config:user.role.anonymous']);
// If the block module is used, the Block page display variant is used,
// which adds the block config entity type's list cache tags.
$page_cache_tags = Cache::mergeTags($page_cache_tags, \Drupal::moduleHandler()->moduleExists('block') ? ['config:block_list']: []);
$page_cache_tags = Cache::mergeTags($page_cache_tags, \Drupal::moduleHandler()->moduleExists('block') ? ['config:block_list'] : []);
$page_cache_tags_referencing_entity = in_array('user.permissions', $this->getAccessCacheContextsForEntity($this->referencingEntity)) ? ['config:user.role.anonymous'] : [];

View file

@ -24,7 +24,7 @@ class EntityListBuilderTest extends WebTestBase {
protected function setUp() {
parent::setUp();
// Create and login user.
// Create and log in user.
$this->webUser = $this->drupalCreateUser(array(
'administer entity_test content',
));

View file

@ -21,7 +21,7 @@ class EntityOperationsTest extends WebTestBase {
protected function setUp() {
parent::setUp();
// Create and login user.
// Create and log in user.
$this->drupalLogin($this->drupalCreateUser(array('administer permissions')));
}

View file

@ -332,6 +332,25 @@ class EntityReferenceSelectionAccessTest extends WebTestBase {
),
);
$this->assertReferenceable($selection_options, $referenceable_tests, 'User handler (does not include anonymous)');
// Check that the Anonymous user is not included in the results when no
// label matching is done, for example when using the 'options_select'
// widget.
$referenceable_tests = array(
array(
'arguments' => array(
array(NULL),
),
'result' => array(
'user' => array(
$users['admin']->id() => $user_labels['admin'],
$users['non_admin']->id() => $user_labels['non_admin'],
$users['blocked']->id() => $user_labels['blocked'],
),
),
),
);
$this->assertReferenceable($selection_options, $referenceable_tests, 'User handler (does not include anonymous)');
}
/**

View file

@ -29,7 +29,7 @@ class EntityRevisionsTest extends WebTestBase {
protected function setUp() {
parent::setUp();
// Create and login user.
// Create and log in user.
$this->webUser = $this->drupalCreateUser(array(
'administer entity_test content',
'view test entity',

View file

@ -0,0 +1,33 @@
<?php
namespace Drupal\system\Tests\Installer;
use Drupal\simpletest\InstallerTestBase;
/**
* Tests the installer when a config_directory has already been set up.
*
* @group Installer
*/
class InstallerExistingConfigDirectoryTest extends InstallerTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->settings['config_directories'][CONFIG_SYNC_DIRECTORY] = (object) array(
'value' => $this->siteDirectory . '/config',
'required' => TRUE,
);
parent::setUp();
}
/**
* Verifies that installation succeeded.
*/
public function testInstaller() {
$this->assertUrl('user/1');
$this->assertResponse(200);
}
}

View file

@ -4,7 +4,7 @@ namespace Drupal\system\Tests\KeyValueStore;
use Drupal\Core\Entity\EntityMalformedException;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\entity_test\Entity\EntityTestLabel;
/**

View file

@ -26,7 +26,7 @@ class ClassLoaderTest extends WebTestBase {
\Drupal::service('module_installer')->install(array('module_test', 'module_autoload_test'), FALSE);
$this->resetAll();
// Check twice to test an unprimed and primed system_list() cache.
for ($i=0; $i<2; $i++) {
for ($i = 0; $i < 2; $i++) {
$this->drupalGet('module-test/class-loading');
$this->assertText($this->expected, 'Autoloader loads classes from an enabled module.');
}
@ -42,7 +42,7 @@ class ClassLoaderTest extends WebTestBase {
$this->container->get('module_installer')->uninstall(array('module_autoload_test'), FALSE);
$this->resetAll();
// Check twice to test an unprimed and primed system_list() cache.
for ($i=0; $i<2; $i++) {
for ($i = 0; $i < 2; $i++) {
$this->drupalGet('module-test/class-loading');
$this->assertNoText($this->expected, 'Autoloader does not load classes from a disabled module.');
}

View file

@ -127,5 +127,14 @@ class RequestPathTest extends KernelTestBase {
$this->assertFalse($condition->evaluate(), 'The system_path /my/pass/page4 fails for a missing path.');
// Test a path of '/'.
$this->aliasManager->addAlias('/', '/my/pass/page3');
$this->currentPath->setPath('/', $request);
$this->requestStack->pop();
$this->requestStack->push($request);
$this->assertTrue($condition->evaluate(), 'The system_path my/pass/page3 passes for wildcard paths.');
$this->assertEqual($condition->summary(), 'Return true on the following pages: /my/pass/*', 'The condition summary matches for a wildcard path');
}
}

View file

@ -82,4 +82,3 @@ abstract class DiscoveryTestBase extends KernelTestBase {
}
}

View file

@ -43,4 +43,3 @@ class StaticDiscoveryTest extends DiscoveryTestBase {
$this->emptyDiscovery = $discovery;
}
}

View file

@ -24,7 +24,7 @@ class AjaxPageStateTest extends WebTestBase {
$this->adminUser = $this->drupalCreateUser(array_keys(\Drupal::service('user.permissions')
->getPermissions()));
// Login so there are more libraries to test with otherwise only html5shiv
// Log in so there are more libraries to test with otherwise only html5shiv
// is the only one in the source we can easily test for.
$this->drupalLogin($this->adminUser);
}

View file

@ -44,7 +44,7 @@ class MatcherDumperTest extends KernelTestBase {
*/
function testCreate() {
$connection = Database::getConnection();
$dumper= new MatcherDumper($connection, $this->state);
$dumper = new MatcherDumper($connection, $this->state);
$class_name = 'Drupal\Core\Routing\MatcherDumper';
$this->assertTrue($dumper instanceof $class_name, 'Dumper created successfully');
@ -55,7 +55,7 @@ class MatcherDumperTest extends KernelTestBase {
*/
function testAddRoutes() {
$connection = Database::getConnection();
$dumper= new MatcherDumper($connection, $this->state);
$dumper = new MatcherDumper($connection, $this->state);
$route = new Route('test');
$collection = new RouteCollection();
@ -76,7 +76,7 @@ class MatcherDumperTest extends KernelTestBase {
*/
function testAddAdditionalRoutes() {
$connection = Database::getConnection();
$dumper= new MatcherDumper($connection, $this->state);
$dumper = new MatcherDumper($connection, $this->state);
$route = new Route('test');
$collection = new RouteCollection();

View file

@ -76,6 +76,10 @@ class MockAliasManager implements AliasManagerInterface {
* @return
*/
public function getAliasByPath($path, $langcode = NULL) {
if ($path[0] !== '/') {
throw new \InvalidArgumentException(sprintf('Source path %s has to start with a slash.', $path));
}
$langcode = $langcode ?: $this->defaultLanguage;
$this->lookedUp[$path] = 1;
return $this->aliases[$path][$langcode];

View file

@ -50,7 +50,7 @@ class SessionTest extends WebTestBase {
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->getRawContent(), $matches);
$this->assertTrue(!empty($matches[1]) , 'Found session ID before logging in.');
$this->assertTrue(!empty($matches[1]), 'Found session ID before logging in.');
$original_session = $matches[1];
// We cannot use $this->drupalLogin($user); because we exit in
@ -67,7 +67,7 @@ class SessionTest extends WebTestBase {
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->getRawContent(), $matches);
$this->assertTrue(!empty($matches[1]) , 'Found session ID after logging in.');
$this->assertTrue(!empty($matches[1]), 'Found session ID after logging in.');
$this->assertTrue($matches[1] != $original_session, 'Session ID changed after login.');
}

View file

@ -56,7 +56,7 @@ class AccessDeniedTest extends WebTestBase {
'site_403' => 'user/' . $this->adminUser->id(),
];
$this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration'));
$this->assertRaw(SafeMarkup::format("The path '%path' has to start with a slash.", ['%path' => $edit['site_403']]));
$this->assertRaw(SafeMarkup::format("The path '%path' has to start with a slash.", ['%path' => $edit['site_403']]));
// Use a custom 403 page.
$edit = [

View file

@ -19,13 +19,20 @@ class DateTimeTest extends WebTestBase {
*
* @var array
*/
public static $modules = ['block', 'node', 'language'];
public static $modules = ['block', 'node', 'language', 'field', 'field_ui', 'datetime', 'options'];
protected function setUp() {
parent::setUp();
// Create admin user and log in admin user.
$this->drupalLogin ($this->drupalCreateUser(array('administer site configuration')));
$this->drupalLogin ($this->drupalCreateUser(array(
'administer site configuration',
'administer content types',
'administer nodes',
'administer node fields',
'administer node form display',
'administer node display',
)));
$this->drupalPlaceBlock('local_actions_block');
}
@ -157,4 +164,64 @@ class DateTimeTest extends WebTestBase {
$this->assertEscaped('<em>' . date("Y") . '</em>');
}
/**
* Test handling case with invalid data in selectors (like February, 31st).
*/
function testEnteringDateTimeViaSelectors() {
$this->drupalCreateContentType(array('type' => 'page_with_date', 'name' => 'Page with date'));
$this->drupalGet('admin/structure/types/manage/page_with_date');
$this->assertResponse(200, 'Content type created.');
$this->drupalGet('admin/structure/types/manage/page_with_date/fields/add-field');
$edit = array(
'new_storage_type' => 'datetime',
'label' => 'dt',
'field_name' => 'dt',
);
$this->drupalPostForm('admin/structure/types/manage/page_with_date/fields/add-field', $edit, t('Save and continue'));
$this->assertText(t('These settings apply to the'), 'New datetime field created, now configuring');
$this->drupalGet('admin/structure/types/manage/page_with_date/fields/node.page_with_date.field_dt/storage');
$edit = array(
'settings[datetime_type]' => 'datetime',
'cardinality' => 'number',
'cardinality_number' => '1',
);
$this->drupalPostForm('admin/structure/types/manage/page_with_date/fields/node.page_with_date.field_dt/storage', $edit, t('Save field settings'));
$this->drupalGet('admin/structure/types/manage/page_with_date/fields');
$this->assertText('field_dt', 'New field is in place');
$this->drupalGet('admin/structure/types/manage/page_with_date/form-display');
$edit = array(
'fields[field_dt][type]' => 'datetime_datelist',
);
$this->drupalPostForm('admin/structure/types/manage/page_with_date/form-display', $edit, t('Save'));
$this->drupalLogout();
// Now log in as a regular editor.
$this->drupalLogin($this->drupalCreateUser(array('create page_with_date content')));
$this->drupalGet('node/add/page_with_date');
$edit = array(
'title[0][value]' => 'sample doc',
'field_dt[0][value][year]' => '2016',
'field_dt[0][value][month]' => '2',
'field_dt[0][value][day]' => '31',
'field_dt[0][value][hour]' => '1',
'field_dt[0][value][minute]' => '30',
);
$this->drupalPostForm('node/add/page_with_date', $edit, t('Save'));
$this->assertText(t('Selected combination of day and month is not valid.'), 'Inorrect date failed validation');
$edit['field_dt[0][value][day]'] = '29';
$this->drupalPostForm('node/add/page_with_date', $edit, t('Save'));
$this->assertNoText(t('Selected combination of day and month is not valid.'), 'Correct date passed validation.');
$this->drupalGet('node/1');
$this->assertText(t('Mon, 02/29/2016 - 01:30'), 'Node successfully created with valid date.');
}
}

View file

@ -2,6 +2,8 @@
namespace Drupal\system\Tests\System;
use Drupal\Core\Flood\DatabaseBackend;
use Drupal\Core\Flood\MemoryBackend;
use Drupal\simpletest\WebTestBase;
use Symfony\Component\HttpFoundation\Request;
@ -59,7 +61,7 @@ class FloodTest extends WebTestBase {
$name = 'flood_test_cleanup';
$request_stack = \Drupal::service('request_stack');
$flood = new \Drupal\Core\Flood\MemoryBackend($request_stack);
$flood = new MemoryBackend($request_stack);
// Register expired event.
$flood->register($name, $window_expired);
// Verify event is not allowed.
@ -87,7 +89,7 @@ class FloodTest extends WebTestBase {
$connection = \Drupal::service('database');
$request_stack = \Drupal::service('request_stack');
$flood = new \Drupal\Core\Flood\DatabaseBackend($connection, $request_stack);
$flood = new DatabaseBackend($connection, $request_stack);
// Register expired event.
$flood->register($name, $window_expired);
// Verify event is not allowed.

View file

@ -70,7 +70,7 @@ class FrontPageTest extends WebTestBase {
// Change the front page to a path without a starting slash.
$edit = ['site_frontpage' => $this->nodePath];
$this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration'));
$this->assertRaw(SafeMarkup::format("The path '%path' has to start with a slash.", ['%path' => $edit['site_frontpage']]));
$this->assertRaw(SafeMarkup::format("The path '%path' has to start with a slash.", ['%path' => $edit['site_frontpage']]));
// Change the front page to a valid path.
$edit['site_frontpage'] = '/' . $this->nodePath;

View file

@ -24,7 +24,7 @@ class MainContentFallbackTest extends WebTestBase {
protected function setUp() {
parent::setUp();
// Create and login admin user.
// Create and log in admin user.
$this->adminUser = $this->drupalCreateUser(array(
'access administration pages',
'administer site configuration',

View file

@ -44,7 +44,7 @@ class PageNotFoundTest extends WebTestBase {
'site_404' => 'user/' . $this->adminUser->id(),
];
$this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration'));
$this->assertRaw(SafeMarkup::format("The path '%path' has to start with a slash.", ['%path' => $edit['site_404']]));
$this->assertRaw(SafeMarkup::format("The path '%path' has to start with a slash.", ['%path' => $edit['site_404']]));
// Use a custom 404 page.
$edit = array(

View file

@ -29,13 +29,13 @@ class SitesDirectoryHardeningTest extends WebTestBase {
// We intentionally don't check for settings.local.php as that file is
// not created by Drupal.
$this->assertTrue(drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE), new FormattableMarkup('Verified permissions for @file.', array('@file' => $settings_file)));
$this->assertTrue(drupal_verify_install_file($settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE), new FormattableMarkup('Verified permissions for @file.', array('@file' => $settings_file)));
$this->makeWritable($site_path);
$this->checkSystemRequirements();
$this->assertTrue(drupal_verify_install_file($site_path, FILE_NOT_WRITABLE, 'dir'), new FormattableMarkup('Verified permissions for @file after manual permissions change.', array('@file' => $site_path)));
$this->assertTrue(drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE), new FormattableMarkup('Verified permissions for @file after manual permissions change.', array('@file' => $settings_file)));
$this->assertTrue(drupal_verify_install_file($settings_file, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE), new FormattableMarkup('Verified permissions for @file after manual permissions change.', array('@file' => $settings_file)));
}
/**

View file

@ -128,4 +128,3 @@ class TwigEnvironmentTest extends KernelTestBase {
}
}

View file

@ -2,14 +2,22 @@
namespace Drupal\system\Tests\TypedData;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\TypedData\DataDefinition;
use Drupal\Core\TypedData\ListDataDefinition;
use Drupal\Core\TypedData\MapDataDefinition;
use Drupal\Core\TypedData\Type\BinaryInterface;
use Drupal\Core\TypedData\Type\BooleanInterface;
use Drupal\Core\TypedData\Type\DateTimeInterface;
use Drupal\Core\TypedData\Type\DurationInterface;
use Drupal\Core\TypedData\Type\FloatInterface;
use Drupal\Core\TypedData\Type\IntegerInterface;
use Drupal\Core\TypedData\Type\StringInterface;
use Drupal\Core\TypedData\Type\UriInterface;
use Drupal\Core\TypedData\TypedDataInterface;
use Drupal\file\Entity\File;
use Drupal\simpletest\KernelTestBase;
use Drupal\Core\Datetime\DrupalDateTime;
/**
* Tests the functionality of all core data types.
@ -49,7 +57,7 @@ class TypedDataTest extends KernelTestBase {
$definition = DataDefinition::create($definition['type']);
}
$data = $this->typedDataManager->create($definition, $value, $name);
$this->assertTrue($data instanceof \Drupal\Core\TypedData\TypedDataInterface, 'Typed data object is an instance of the typed data interface.');
$this->assertTrue($data instanceof TypedDataInterface, 'Typed data object is an instance of the typed data interface.');
return $data;
}
@ -59,7 +67,7 @@ class TypedDataTest extends KernelTestBase {
public function testGetAndSet() {
// Boolean type.
$typed_data = $this->createTypedData(array('type' => 'boolean'), TRUE);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\BooleanInterface, 'Typed data object is an instance of BooleanInterface.');
$this->assertTrue($typed_data instanceof BooleanInterface, 'Typed data object is an instance of BooleanInterface.');
$this->assertTrue($typed_data->getValue() === TRUE, 'Boolean value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$typed_data->setValue(FALSE);
@ -75,7 +83,7 @@ class TypedDataTest extends KernelTestBase {
// String type.
$value = $this->randomString();
$typed_data = $this->createTypedData(array('type' => 'string'), $value);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\StringInterface, 'Typed data object is an instance of StringInterface.');
$this->assertTrue($typed_data instanceof StringInterface, 'Typed data object is an instance of StringInterface.');
$this->assertTrue($typed_data->getValue() === $value, 'String value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$new_value = $this->randomString();
@ -93,7 +101,7 @@ class TypedDataTest extends KernelTestBase {
// Integer type.
$value = rand();
$typed_data = $this->createTypedData(array('type' => 'integer'), $value);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\IntegerInterface, 'Typed data object is an instance of IntegerInterface.');
$this->assertTrue($typed_data instanceof IntegerInterface, 'Typed data object is an instance of IntegerInterface.');
$this->assertTrue($typed_data->getValue() === $value, 'Integer value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$new_value = rand();
@ -110,7 +118,7 @@ class TypedDataTest extends KernelTestBase {
// Float type.
$value = 123.45;
$typed_data = $this->createTypedData(array('type' => 'float'), $value);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\FloatInterface, 'Typed data object is an instance of FloatInterface.');
$this->assertTrue($typed_data instanceof FloatInterface, 'Typed data object is an instance of FloatInterface.');
$this->assertTrue($typed_data->getValue() === $value, 'Float value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$new_value = 678.90;
@ -127,7 +135,7 @@ class TypedDataTest extends KernelTestBase {
// Date Time type.
$value = '2014-01-01T20:00:00+00:00';
$typed_data = $this->createTypedData(array('type' => 'datetime_iso8601'), $value);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\DateTimeInterface, 'Typed data object is an instance of DateTimeInterface.');
$this->assertTrue($typed_data instanceof DateTimeInterface, 'Typed data object is an instance of DateTimeInterface.');
$this->assertTrue($typed_data->getValue() == $value, 'Date value was fetched.');
$this->assertEqual($typed_data->getValue(), $typed_data->getDateTime()->format('c'), 'Value representation of a date is ISO 8601');
$this->assertEqual($typed_data->validate()->count(), 0);
@ -153,7 +161,7 @@ class TypedDataTest extends KernelTestBase {
// Timestamp type.
$value = REQUEST_TIME;
$typed_data = $this->createTypedData(array('type' => 'timestamp'), $value);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\DateTimeInterface, 'Typed data object is an instance of DateTimeInterface.');
$this->assertTrue($typed_data instanceof DateTimeInterface, 'Typed data object is an instance of DateTimeInterface.');
$this->assertTrue($typed_data->getValue() == $value, 'Timestamp value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$new_value = REQUEST_TIME + 1;
@ -176,7 +184,7 @@ class TypedDataTest extends KernelTestBase {
// DurationIso8601 type.
$value = 'PT20S';
$typed_data = $this->createTypedData(array('type' => 'duration_iso8601'), $value);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\DurationInterface, 'Typed data object is an instance of DurationInterface.');
$this->assertTrue($typed_data instanceof DurationInterface, 'Typed data object is an instance of DurationInterface.');
$this->assertIdentical($typed_data->getValue(), $value, 'DurationIso8601 value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$typed_data->setValue('P40D');
@ -200,7 +208,7 @@ class TypedDataTest extends KernelTestBase {
// Time span type.
$value = 20;
$typed_data = $this->createTypedData(array('type' => 'timespan'), $value);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\DurationInterface, 'Typed data object is an instance of DurationInterface.');
$this->assertTrue($typed_data instanceof DurationInterface, 'Typed data object is an instance of DurationInterface.');
$this->assertIdentical($typed_data->getValue(), $value, 'Time span value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$typed_data->setValue(60 * 60 * 4);
@ -223,7 +231,7 @@ class TypedDataTest extends KernelTestBase {
// URI type.
$uri = 'http://example.com/foo/';
$typed_data = $this->createTypedData(array('type' => 'uri'), $uri);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\UriInterface, 'Typed data object is an instance of UriInterface.');
$this->assertTrue($typed_data instanceof UriInterface, 'Typed data object is an instance of UriInterface.');
$this->assertTrue($typed_data->getValue() === $uri, 'URI value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
$typed_data->setValue($uri . 'bar.txt');
@ -251,7 +259,7 @@ class TypedDataTest extends KernelTestBase {
// Email type.
$value = $this->randomString();
$typed_data = $this->createTypedData(array('type' => 'email'), $value);
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\StringInterface, 'Typed data object is an instance of StringInterface.');
$this->assertTrue($typed_data instanceof StringInterface, 'Typed data object is an instance of StringInterface.');
$this->assertIdentical($typed_data->getValue(), $value, 'Email value was fetched.');
$new_value = 'test@example.com';
$typed_data->setValue($new_value);
@ -266,7 +274,7 @@ class TypedDataTest extends KernelTestBase {
// Binary type.
$typed_data = $this->createTypedData(array('type' => 'binary'), $files[0]->getFileUri());
$this->assertTrue($typed_data instanceof \Drupal\Core\TypedData\Type\BinaryInterface, 'Typed data object is an instance of BinaryInterface.');
$this->assertTrue($typed_data instanceof BinaryInterface, 'Typed data object is an instance of BinaryInterface.');
$this->assertTrue(is_resource($typed_data->getValue()), 'Binary value was fetched.');
$this->assertEqual($typed_data->validate()->count(), 0);
// Try setting by URI.
@ -441,7 +449,7 @@ class TypedDataTest extends KernelTestBase {
// Test iterating.
$count = 0;
foreach ($typed_data as $item) {
$this->assertTrue($item instanceof \Drupal\Core\TypedData\TypedDataInterface);
$this->assertTrue($item instanceof TypedDataInterface);
$count++;
}
$this->assertEqual($count, 3);

View file

@ -51,7 +51,7 @@ class LocalActionsAndTasksConvertedIntoBlocksUpdateTest extends UpdatePathTestBa
// after updates in https://www.drupal.org/node/2435135.
\Drupal::state()->set('system.maintenance_mode', FALSE);
// We finished updating so we can login the user now.
// We finished updating so we can log in the user now.
$this->drupalLogin($this->rootUser);
$page = Node::create([

View file

@ -50,7 +50,7 @@ class PageTitleConvertedIntoBlockUpdateTest extends UpdatePathTestBase {
// after updates in https://www.drupal.org/node/2435135.
\Drupal::state()->set('system.maintenance_mode', FALSE);
// We finished updating so we can login the user now.
// We finished updating so we can log in the user now.
$this->drupalLogin($this->rootUser);
$page = Node::create([

View file

@ -45,7 +45,7 @@ class SevenSecondaryLocalTasksConvertedIntoBlockUpdateTest extends UpdatePathTes
// after updates in https://www.drupal.org/node/2435135.
\Drupal::state()->set('system.maintenance_mode', FALSE);
// We finished updating so we can login the user now.
// We finished updating so we can log in the user now.
$this->drupalLogin($this->rootUser);
// Local actions are visible on the content listing page.

View file

@ -45,7 +45,7 @@ class SiteBrandingConvertedIntoBlockUpdateTest extends UpdatePathTestBase {
// after updates in https://www.drupal.org/node/2435135.
\Drupal::state()->set('system.maintenance_mode', FALSE);
// We finished updating so we can login the user now.
// We finished updating so we can log in the user now.
$this->drupalLogin($this->rootUser);
// Site branding is visible on the home page.

View file

@ -14,7 +14,7 @@ class UpdatePathWithBrokenRoutingFilledTest extends UpdatePathWithBrokenRoutingT
*/
protected function setDatabaseDumpFiles() {
parent::setDatabaseDumpFiles();
$this->databaseDumpFiles[0] = __DIR__ . '/../../../tests/fixtures/update/drupal-8.filled.standard.php.gz';
$this->databaseDumpFiles[0] = __DIR__ . '/../../../tests/fixtures/update/drupal-8.filled.standard.php.gz';
}
}

View file

@ -56,20 +56,38 @@ class UpdateScriptTest extends WebTestBase {
$this->drupalGet($this->updateUrl, array('external' => TRUE));
$this->assertResponse(403);
// Check that a link to the update page is not accessible to regular users.
$this->drupalGet('/update-script-test/database-updates-menu-item');
$this->assertNoLink('Run database updates');
// Try accessing update.php as an anonymous user.
$this->drupalLogout();
$this->drupalGet($this->updateUrl, array('external' => TRUE));
$this->assertResponse(403);
// Check that a link to the update page is not accessible to anonymous
// users.
$this->drupalGet('/update-script-test/database-updates-menu-item');
$this->assertNoLink('Run database updates');
// Access the update page with the proper permission.
$this->drupalLogin($this->updateUser);
$this->drupalGet($this->updateUrl, array('external' => TRUE));
$this->assertResponse(200);
// Check that a link to the update page is accessible to users with proper
// permissions.
$this->drupalGet('/update-script-test/database-updates-menu-item');
$this->assertLink('Run database updates');
// Access the update page as user 1.
$this->drupalLogin($this->rootUser);
$this->drupalGet($this->updateUrl, array('external' => TRUE));
$this->assertResponse(200);
// Check that a link to the update page is accessible to user 1.
$this->drupalGet('/update-script-test/database-updates-menu-item');
$this->assertLink('Run database updates');
}
/**

View file

@ -385,4 +385,3 @@ function template_preprocess_system_themes_page(&$variables) {
}
$variables['theme_groups'] = $groups;
}

View file

@ -384,7 +384,7 @@ function system_requirements($phase) {
}
foreach (array('settings.php', 'settings.local.php', 'services.yml') as $conf_file) {
$full_path = $site_path . '/' . $conf_file;
if (file_exists($full_path) && (Settings::get('skip_permissions_hardening') || !drupal_verify_install_file($full_path, FILE_EXIST|FILE_READABLE|FILE_NOT_WRITABLE))) {
if (file_exists($full_path) && (Settings::get('skip_permissions_hardening') || !drupal_verify_install_file($full_path, FILE_EXIST | FILE_READABLE | FILE_NOT_WRITABLE))) {
$conf_errors[] = t("The file %file is not protected from modifications and poses a security risk. You must change the file's permissions to be non-writable.", array('%file' => $full_path));
}
}

View file

@ -1254,7 +1254,7 @@ function system_get_module_admin_tasks($module, array $info) {
$access_manager = \Drupal::service('access_manager');
if ($access_manager->checkNamedRoute('user.admin_permissions', array(), \Drupal::currentUser())) {
/** @var \Drupal\Core\Url $url */
$url = new \Drupal\Core\Url('user.admin_permissions');
$url = new Url('user.admin_permissions');
$url->setOption('fragment', 'module-' . $module);
$admin_tasks["user.admin_permissions.$module"] = array(
'title' => t('Configure @module permissions', array('@module' => $info['name'])),

View file

@ -465,7 +465,7 @@ system.db_update:
defaults:
op: 'info'
requirements:
_access: 'TRUE'
_access_system_update: 'TRUE'
options:
default_url_options:
path_processing: FALSE

View file

@ -147,4 +147,3 @@ $connection->delete('router')
$connection->delete('router')
->condition('name', 'entity.block_content_type.%', 'LIKE')
->execute();

View file

@ -6,19 +6,20 @@
* upgrade path of https://www.drupal.org/node/2354889.
*/
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// A custom block with visibility settings.
$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2354889.yml'));
$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2354889.yml'));
// A custom block without any visibility settings.
$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.secondtestfor2354889.yml'));
$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.secondtestfor2354889.yml'));
// A custom block with visibility settings that contain a non-existing context
// mapping.
$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.thirdtestfor2354889.yml'));
$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.thirdtestfor2354889.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')

View file

@ -20,4 +20,3 @@ $connection->update('config')
$connection->insert('key_value')
->fields(['collection' => 'system.schema', 'name' => 'update_script_test', 'value' => serialize(8000)])
->execute();

View file

@ -6,12 +6,13 @@
* upgrade path of https://www.drupal.org/node/507488.
*/
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Structure of a custom block with visibility settings.
$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor507488.yml'));
$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor507488.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')

View file

@ -6,12 +6,13 @@
* upgrade path of https://www.drupal.org/node/2476947.
*/
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Structure of a custom block with visibility settings.
$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2476947.yml'));
$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2476947.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')

View file

@ -6,12 +6,13 @@
* upgrade path of https://www.drupal.org/node/507488.
*/
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Structure of a custom block with visibility settings.
$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2569529.yml'));
$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2569529.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')

View file

@ -6,12 +6,13 @@
* upgrade path of https://www.drupal.org/node/2005546.
*/
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Structure of a custom block with visibility settings.
$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2005546.yml'));
$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2005546.yml'));
foreach ($block_configs as $block_config) {
$connection->insert('config')

View file

@ -37,4 +37,3 @@ $connection->update('config')
->condition('collection', '')
->condition('name', 'core.extension')
->execute();

View file

@ -36,4 +36,3 @@ $connection->update('config')
->condition('collection', '')
->condition('name', 'core.extension')
->execute();

View file

@ -6,6 +6,7 @@
* upgrade path of https://www.drupal.org/node/2455125.
*/
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
@ -13,7 +14,7 @@ $connection = Database::getConnection();
// Structure of a view with timestamp fields.
$views_configs = [];
$views_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/drupal-8.views-entity-views-data-2455125.yml'));
$views_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/drupal-8.views-entity-views-data-2455125.yml'));
foreach ($views_configs as $views_config) {
$connection->insert('config')

View file

@ -5,7 +5,9 @@
* Test fixture.
*/
$connection = Drupal\Core\Database\Database::getConnection();
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
$config = $connection;
$connection->merge('config')

View file

@ -5,8 +5,22 @@
* Simpletest mock module for Ajax forms testing.
*/
use Drupal\Core\Ajax;
use Drupal\Core\Ajax\AddCssCommand;
use Drupal\Core\Ajax\AfterCommand;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\AlertCommand;
use Drupal\Core\Ajax\AppendCommand;
use Drupal\Core\Ajax\BeforeCommand;
use Drupal\Core\Ajax\ChangedCommand;
use Drupal\Core\Ajax\CssCommand;
use Drupal\Core\Ajax\DataCommand;
use Drupal\Core\Ajax\HtmlCommand;
use Drupal\Core\Ajax\InsertCommand;
use Drupal\Core\Ajax\InvokeCommand;
use Drupal\Core\Ajax\PrependCommand;
use Drupal\Core\Ajax\RemoveCommand;
use Drupal\Core\Ajax\RestripeCommand;
use Drupal\Core\Ajax\SettingsCommand;
use Drupal\Core\Form\FormStateInterface;
/**
@ -16,7 +30,7 @@ function ajax_forms_test_advanced_commands_after_callback($form, FormStateInterf
$selector = '#after_div';
$response = new AjaxResponse();
$response->addCommand(new Ajax\AfterCommand($selector, "This will be placed after"));
$response->addCommand(new AfterCommand($selector, "This will be placed after"));
return $response;
}
@ -25,7 +39,7 @@ function ajax_forms_test_advanced_commands_after_callback($form, FormStateInterf
*/
function ajax_forms_test_advanced_commands_alert_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$response->addCommand(new Ajax\AlertCommand('Alert'));
$response->addCommand(new AlertCommand('Alert'));
return $response;
}
@ -35,7 +49,7 @@ function ajax_forms_test_advanced_commands_alert_callback($form, FormStateInterf
function ajax_forms_test_advanced_commands_append_callback($form, FormStateInterface $form_state) {
$selector = '#append_div';
$response = new AjaxResponse();
$response->addCommand(new Ajax\AppendCommand($selector, "Appended text"));
$response->addCommand(new AppendCommand($selector, "Appended text"));
return $response;
}
@ -45,7 +59,7 @@ function ajax_forms_test_advanced_commands_append_callback($form, FormStateInter
function ajax_forms_test_advanced_commands_before_callback($form, FormStateInterface $form_state) {
$selector = '#before_div';
$response = new AjaxResponse();
$response->addCommand(new Ajax\BeforeCommand($selector, "Before text"));
$response->addCommand(new BeforeCommand($selector, "Before text"));
return $response;
}
@ -54,7 +68,7 @@ function ajax_forms_test_advanced_commands_before_callback($form, FormStateInter
*/
function ajax_forms_test_advanced_commands_changed_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$response->addCommand(new Ajax\ChangedCommand('#changed_div'));
$response->addCommand(new ChangedCommand('#changed_div'));
return $response;
}
@ -63,7 +77,7 @@ function ajax_forms_test_advanced_commands_changed_callback($form, FormStateInte
*/
function ajax_forms_test_advanced_commands_changed_asterisk_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$response->addCommand(new Ajax\ChangedCommand('#changed_div', '#changed_div_mark_this'));
$response->addCommand(new ChangedCommand('#changed_div', '#changed_div_mark_this'));
return $response;
}
@ -75,7 +89,7 @@ function ajax_forms_test_advanced_commands_css_callback($form, FormStateInterfac
$color = 'blue';
$response = new AjaxResponse();
$response->addCommand(new Ajax\CssCommand($selector, array('background-color' => $color)));
$response->addCommand(new CssCommand($selector, array('background-color' => $color)));
return $response;
}
@ -85,7 +99,7 @@ function ajax_forms_test_advanced_commands_css_callback($form, FormStateInterfac
function ajax_forms_test_advanced_commands_data_callback($form, FormStateInterface $form_state) {
$selector = '#data_div';
$response = new AjaxResponse();
$response->addCommand(new Ajax\DataCommand($selector, 'testkey', 'testvalue'));
$response->addCommand(new DataCommand($selector, 'testkey', 'testvalue'));
return $response;
}
@ -94,7 +108,7 @@ function ajax_forms_test_advanced_commands_data_callback($form, FormStateInterfa
*/
function ajax_forms_test_advanced_commands_invoke_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$response->addCommand(new Ajax\InvokeCommand('#invoke_div', 'addClass', array('error')));
$response->addCommand(new InvokeCommand('#invoke_div', 'addClass', array('error')));
return $response;
}
@ -103,7 +117,7 @@ function ajax_forms_test_advanced_commands_invoke_callback($form, FormStateInter
*/
function ajax_forms_test_advanced_commands_html_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$response->addCommand(new Ajax\HtmlCommand('#html_div', 'replacement text'));
$response->addCommand(new HtmlCommand('#html_div', 'replacement text'));
return $response;
}
@ -112,7 +126,7 @@ function ajax_forms_test_advanced_commands_html_callback($form, FormStateInterfa
*/
function ajax_forms_test_advanced_commands_insert_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$response->addCommand(new Ajax\InsertCommand('#insert_div', 'insert replacement text'));
$response->addCommand(new InsertCommand('#insert_div', 'insert replacement text'));
return $response;
}
@ -121,7 +135,7 @@ function ajax_forms_test_advanced_commands_insert_callback($form, FormStateInter
*/
function ajax_forms_test_advanced_commands_prepend_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$response->addCommand(new Ajax\PrependCommand('#prepend_div', "prepended text"));
$response->addCommand(new PrependCommand('#prepend_div', "prepended text"));
return $response;
}
@ -130,7 +144,7 @@ function ajax_forms_test_advanced_commands_prepend_callback($form, FormStateInte
*/
function ajax_forms_test_advanced_commands_remove_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$response->addCommand(new Ajax\RemoveCommand('#remove_text'));
$response->addCommand(new RemoveCommand('#remove_text'));
return $response;
}
@ -139,7 +153,7 @@ function ajax_forms_test_advanced_commands_remove_callback($form, FormStateInter
*/
function ajax_forms_test_advanced_commands_restripe_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$response->addCommand(new Ajax\RestripeCommand('#restripe_table'));
$response->addCommand(new RestripeCommand('#restripe_table'));
return $response;
}
@ -149,7 +163,7 @@ function ajax_forms_test_advanced_commands_restripe_callback($form, FormStateInt
function ajax_forms_test_advanced_commands_settings_callback($form, FormStateInterface $form_state) {
$setting['ajax_forms_test']['foo'] = 42;
$response = new AjaxResponse();
$response->addCommand(new Ajax\SettingsCommand($setting));
$response->addCommand(new SettingsCommand($setting));
return $response;
}
@ -158,7 +172,7 @@ function ajax_forms_test_advanced_commands_settings_callback($form, FormStateInt
*/
function ajax_forms_test_advanced_commands_add_css_callback($form, FormStateInterface $form_state) {
$response = new AjaxResponse();
$response->addCommand(new Ajax\AddCssCommand('my/file.css'));
$response->addCommand(new AddCssCommand('my/file.css'));
return $response;
}

View file

@ -4,7 +4,7 @@ namespace Drupal\condition_test\Tests;
use Drupal\Core\Plugin\Context\Context;
use Drupal\Core\Plugin\Context\ContextDefinition;
use Drupal\simpletest\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
use Drupal\user\Entity\User;
/**

View file

@ -47,4 +47,3 @@ function database_test_query_alter(AlterableInterface $query) {
function database_test_query_database_test_alter_remove_range_alter(AlterableInterface $query) {
$query->range();
}

View file

@ -52,7 +52,7 @@ class DatabaseTestForm extends FormBase {
$options[$account->id()] = array(
'title' => array('data' => array('#title' => $account->getUsername())),
'username' => $account->getUsername(),
'status' => $account->isActive() ? t('active') : t('blocked'),
'status' => $account->isActive() ? t('active') : t('blocked'),
);
}

View file

@ -63,6 +63,13 @@ class EntityTestRev extends EntityTest {
$fields['name']->setRevisionable(TRUE);
$fields['user_id']->setRevisionable(TRUE);
$fields['non_rev_field'] = BaseFieldDefinition::create('string')
->setLabel(t('Non Revisionable Field'))
->setDescription(t('A non-revisionable test field.'))
->setRevisionable(FALSE)
->setCardinality(1)
->setReadOnly(TRUE);
return $fields;
}

View file

@ -5,12 +5,13 @@
* Contains hook implementations for Entity Operation Test Module.
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;
/**
* Implements hook_entity_operation().
*/
function entity_test_operation_entity_operation(\Drupal\Core\Entity\EntityInterface $entity) {
function entity_test_operation_entity_operation(EntityInterface $entity) {
return [
'test' => [
'title' => t('Front page'),

View file

@ -46,7 +46,7 @@ class ErrorTestController extends ControllerBase {
// This will generate a notice.
$monkey_love = $bananas;
// This will generate a warning.
$awesomely_big = 1/0;
$awesomely_big = 1 / 0;
// This will generate a user error. Use & to check for double escaping.
trigger_error("Drupal & awesome", E_USER_WARNING);
return [];

View file

@ -2,6 +2,8 @@
namespace Drupal\module_test\Controller;
use Drupal\module_autoload_test\SomeClass;
/**
* Controller routines for module_test routes.
*/
@ -38,7 +40,7 @@ class ModuleTestController {
public function testClassLoading() {
$markup = NULL;
if (class_exists('Drupal\module_autoload_test\SomeClass')) {
$obj = new \Drupal\module_autoload_test\SomeClass();
$obj = new SomeClass();
$markup = $obj->testMethod();
}
return ['#markup' => $markup];

View file

@ -6,4 +6,3 @@ namespace Drupal\plugin_test\Plugin\plugin_test\fruit;
* Provides an interface for test plugins.
*/
interface FruitInterface { }

View file

@ -36,10 +36,10 @@ class MockMenuBlock {
// nesting level. For depth=2, this returns:
// '<ul><li>1<ul><li>1.1</li></ul></li></ul>'.
$content = '';
for ($i=0; $i < $this->depth; $i++) {
$content .= '<ul><li>' . implode('.', array_fill(0, $i+1, '1'));
for ($i = 0; $i < $this->depth; $i++) {
$content .= '<ul><li>' . implode('.', array_fill(0, $i + 1, '1'));
}
for ($i=0; $i < $this->depth; $i++) {
for ($i = 0; $i < $this->depth; $i++) {
$content .= '</li></ul>';
}
return $content;

View file

@ -28,4 +28,3 @@ class PageCacheAcceptHeaderController {
}
}
}

View file

@ -14,7 +14,7 @@ class MockFileTransfer {
* A new Drupal\system_test\MockFileTransfer object.
*/
public static function factory() {
return new MockFileTransfer;
return new MockFileTransfer();
}
/**

View file

@ -81,7 +81,7 @@ class ThemeTestController extends ControllerBase {
* Content in theme_test_output GLOBAL.
*/
public function testRequestListener() {
return ['#markup' => $GLOBALS['theme_test_output']];
return ['#markup' => $GLOBALS['theme_test_output']];
}
/**

View file

@ -17,4 +17,3 @@ class TrustedHostsTestController {
}
}

View file

@ -20,4 +20,3 @@ function twig_extension_test_theme($existing, $type, $theme, $path) {
),
);
}

View file

@ -0,0 +1,31 @@
<?php
namespace Drupal\update_script_test\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\Request;
/**
* Controller routines for update_script_test routes.
*/
class UpdateScriptTestController extends ControllerBase {
/**
* Outputs a link to the database updates URL.
*/
public function databaseUpdatesMenuItem(Request $request) {
// @todo Simplify with https://www.drupal.org/node/2548095
$base_url = str_replace('/update.php', '', $request->getBaseUrl());
$url = (new Url('system.db_update'))->setOption('base_url', $base_url);
$build['main'] = array(
'#type' => 'link',
'#title' => $this->t('Run database updates'),
'#url' => $url,
'#access' => $url->access($this->currentUser()),
);
return $build;
}
}

View file

@ -0,0 +1,6 @@
update_script_test.database_updates_menu_item:
path: '/update-script-test/database-updates-menu-item'
defaults:
_controller: '\Drupal\update_script_test\Controller\UpdateScriptTestController::databaseUpdatesMenuItem'
requirements:
_access: 'TRUE'

View file

@ -64,6 +64,6 @@ function update_test_postupdate_post_update_test_batch(&$sandbox = NULL) {
$execution[] = __FUNCTION__ . '-' . $sandbox['current_step'];
\Drupal::state()->set('post_update_test_execution', $execution);
$sandbox['#finished'] = $sandbox['current_step'] / $sandbox['steps'];
$sandbox['#finished'] = $sandbox['current_step'] / $sandbox['steps'];
return 'Test post update batches';
}

View file

@ -2,6 +2,7 @@
namespace Drupal\Tests\system\Kernel\Extension;
use Drupal\Core\Extension\MissingDependencyException;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use \Drupal\Core\Extension\ModuleUninstallValidatorException;
use Drupal\entity_test\Entity\EntityTest;
@ -121,7 +122,7 @@ class ModuleHandlerTest extends KernelTestBase {
$result = $this->moduleInstaller()->install(array('color'));
$this->fail(t('ModuleInstaller::install() throws an exception if dependencies are missing.'));
}
catch (\Drupal\Core\Extension\MissingDependencyException $e) {
catch (MissingDependencyException $e) {
$this->pass(t('ModuleInstaller::install() throws an exception if dependencies are missing.'));
}

View file

@ -1,6 +1,6 @@
<?php
namespace Drupal\system\Tests\System;
namespace Drupal\Tests\system\Kernel\Token;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Utility\Html;
@ -13,7 +13,7 @@ use Drupal\Core\Render\BubbleableMetadata;
*
* @group system
*/
class TokenReplaceUnitTest extends TokenReplaceUnitTestBase {
class TokenReplaceKernelTest extends TokenReplaceKernelTestBase {
/**
* {@inheritdoc}

View file

@ -1,13 +1,13 @@
<?php
namespace Drupal\system\Tests\System;
namespace Drupal\Tests\system\Kernel\Token;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
/**
* Base class for token replacement tests.
*/
abstract class TokenReplaceUnitTestBase extends EntityUnitTestBase {
abstract class TokenReplaceKernelTestBase extends EntityKernelTestBase {
/**
* The interface language.

View file

@ -142,7 +142,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
$breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
$this->assertEquals([], $breadcrumb->getLinks());
$this->assertEquals(['url.path'], $breadcrumb->getCacheContexts());
$this->assertEquals(['url.path.parent'], $breadcrumb->getCacheContexts());
$this->assertEquals([], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}
@ -159,7 +159,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
$breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
$this->assertEquals([0 => new Link('Home', new Url('<front>'))], $breadcrumb->getLinks());
$this->assertEquals(['url.path'], $breadcrumb->getCacheContexts());
$this->assertEquals(['url.path.parent'], $breadcrumb->getCacheContexts());
$this->assertEquals([], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}
@ -194,7 +194,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
$breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
$this->assertEquals([0 => new Link('Home', new Url('<front>')), 1 => new Link('Example', new Url('example'))], $breadcrumb->getLinks());
$this->assertEquals(['url.path', 'user.permissions'], $breadcrumb->getCacheContexts());
$this->assertEquals(['url.path.parent', 'user.permissions'], $breadcrumb->getCacheContexts());
$this->assertEquals([], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}
@ -245,7 +245,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
new Link('Example', new Url('example')),
new Link('Bar', new Url('example_bar')),
], $breadcrumb->getLinks());
$this->assertEquals(['bar', 'url.path', 'user.permissions'], $breadcrumb->getCacheContexts());
$this->assertEquals(['bar', 'url.path.parent', 'user.permissions'], $breadcrumb->getCacheContexts());
$this->assertEquals(['example'], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}
@ -272,7 +272,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
// No path matched, though at least the frontpage is displayed.
$this->assertEquals([0 => new Link('Home', new Url('<front>'))], $breadcrumb->getLinks());
$this->assertEquals(['url.path'], $breadcrumb->getCacheContexts());
$this->assertEquals(['url.path.parent'], $breadcrumb->getCacheContexts());
$this->assertEquals([], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}
@ -316,7 +316,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
// No path matched, though at least the frontpage is displayed.
$this->assertEquals([0 => new Link('Home', new Url('<front>'))], $breadcrumb->getLinks());
$this->assertEquals(['url.path'], $breadcrumb->getCacheContexts());
$this->assertEquals(['url.path.parent'], $breadcrumb->getCacheContexts());
$this->assertEquals([], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}
@ -364,7 +364,7 @@ class PathBasedBreadcrumbBuilderTest extends UnitTestCase {
$breadcrumb = $this->builder->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
$this->assertEquals([0 => new Link('Home', new Url('<front>')), 1 => new Link('Admin', new Url('user_page'))], $breadcrumb->getLinks());
$this->assertEquals(['url.path', 'user.permissions'], $breadcrumb->getCacheContexts());
$this->assertEquals(['url.path.parent', 'user.permissions'], $breadcrumb->getCacheContexts());
$this->assertEquals([], $breadcrumb->getCacheTags());
$this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
}

View file

@ -29,7 +29,7 @@ class InstallTranslationFilePatternTest extends UnitTestCase {
parent::setUp();
$this->fileTranslation = new FileTranslation('filename');
$method = new \ReflectionMethod('\Drupal\Core\StringTranslation\Translator\FileTranslation', 'getTranslationFilesPattern');
$method->setAccessible(true);
$method->setAccessible(TRUE);
$this->filePatternMethod = $method;
}

View file

@ -6,12 +6,13 @@ use Drupal\system\SystemRequirements;
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass Drupal\system\SystemRequirements
* @coversDefaultClass \Drupal\system\SystemRequirements
* @group system
*/
class SystemRequirementsTest extends UnitTestCase {
/**
* @covers ::phpVersionWithPdoDisallowMultipleStatements
* @dataProvider providerTestPhpVersionWithPdoDisallowMultipleStatements
*/
public function testPhpVersionWithPdoDisallowMultipleStatements($version, $expected) {

View file

@ -10,4 +10,3 @@
*/
function test_subsubtheme_preprocess_theme_test_template_test(&$variables) {
}