Commit f464f8ee authored by Dries's avatar Dries
Browse files

Merge branch '8.x' of git.drupal.org:project/drupal into 8.x

parents 2a18edd9 bf00ad1c
......@@ -10,6 +10,7 @@
"symfony/http-kernel": "<2.4",
"symfony/routing": "<2.4",
"symfony/serializer": "<2.4",
"symfony/validator": "<2.4",
"symfony/yaml": "<2.4",
"twig/twig": "1.*@stable",
"doctrine/common": "2.3.*@stable",
......
{
"hash": "4c18d6f1c91b78555300b0036b5a8a7e",
"hash": "fb8595c6fbaaa5bf51bf7efeb67d73bc",
"packages": [
{
"name": "doctrine/common",
......@@ -25,6 +25,7 @@
"dev-master": "2.3.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Doctrine\\Common": "lib/"
......@@ -97,6 +98,7 @@
},
"time": "2013-01-13 01:20:04",
"type": "library",
"installation-source": "source",
"autoload": {
"psr-0": {
"EasyRdf_": "lib/"
......@@ -150,6 +152,7 @@
"dev-master": "3.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Guzzle\\Common": ""
......@@ -197,6 +200,7 @@
"dev-master": "3.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Guzzle\\Http": ""
......@@ -248,6 +252,7 @@
"dev-master": "3.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Guzzle\\Parser": ""
......@@ -293,6 +298,7 @@
"dev-master": "3.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Guzzle\\Stream": ""
......@@ -354,6 +360,7 @@
"dev-master": "1.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Assetic": "src/"
......@@ -405,6 +412,7 @@
"dev-master": "1.0-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Cmf\\Component\\Routing": ""
......@@ -455,6 +463,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\ClassLoader\\": ""
......@@ -510,6 +519,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\DependencyInjection\\": ""
......@@ -564,6 +574,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\EventDispatcher\\": ""
......@@ -611,6 +622,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\HttpFoundation\\": ""
......@@ -682,6 +694,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\HttpKernel\\": ""
......@@ -724,6 +737,7 @@
},
"time": "2012-12-06 10:00:55",
"type": "library",
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Process": ""
......@@ -782,6 +796,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Routing\\": ""
......@@ -829,6 +844,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Serializer\\": ""
......@@ -851,6 +867,123 @@
"description": "Symfony Serializer Component",
"homepage": "http://symfony.com"
},
{
"name": "symfony/translation",
"version": "dev-master",
"target-dir": "Symfony/Component/Translation",
"source": {
"type": "git",
"url": "https://github.com/symfony/Translation",
"reference": "v2.2.0-BETA2"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Translation/archive/v2.2.0-BETA2.zip",
"reference": "v2.2.0-BETA2",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"symfony/config": "2.2.*",
"symfony/yaml": "2.2.*"
},
"suggest": {
"symfony/config": "2.2.*",
"symfony/yaml": "2.2.*"
},
"time": "2013-01-17 15:25:59",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Translation\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Translation Component",
"homepage": "http://symfony.com"
},
{
"name": "symfony/validator",
"version": "dev-master",
"target-dir": "Symfony/Component/Validator",
"source": {
"type": "git",
"url": "https://github.com/symfony/Validator",
"reference": "f764b2e61c51c45f93bd4c9fe933e6a66928d2d3"
},
"dist": {
"type": "zip",
"url": "https://github.com/symfony/Validator/archive/f764b2e61c51c45f93bd4c9fe933e6a66928d2d3.zip",
"reference": "f764b2e61c51c45f93bd4c9fe933e6a66928d2d3",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/translation": "2.2.*"
},
"require-dev": {
"symfony/http-foundation": "2.2.*",
"symfony/locale": "2.2.*",
"symfony/yaml": "2.2.*",
"symfony/config": "2.2.*"
},
"suggest": {
"doctrine/common": ">=2.1,<2.4-dev",
"symfony/http-foundation": "2.2.*",
"symfony/yaml": "2.2.*",
"symfony/config": "2.2.*"
},
"time": "2013-01-24 10:00:40",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Validator\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"description": "Symfony Validator Component",
"homepage": "http://symfony.com"
},
{
"name": "symfony/yaml",
"version": "dev-master",
......@@ -876,6 +1009,7 @@
"dev-master": "2.2-dev"
}
},
"installation-source": "source",
"autoload": {
"psr-0": {
"Symfony\\Component\\Yaml\\": ""
......@@ -922,6 +1056,7 @@
"dev-master": "1.11-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Twig_": "lib/"
......
......@@ -888,18 +888,18 @@ function drupal_get_filename($type, $name, $filename = NULL) {
// nothing
}
else {
if ($type == 'module') {
if (empty($files[$type])) {
$files[$type] = drupal_container()->get('module_handler')->getModuleList();
}
if (isset($files[$type][$name])) {
return $files[$type][$name];
}
}
// Verify that we have an keyvalue service before using it. This is required
// because this function is called during installation.
// @todo Inject database connection into KeyValueStore\DatabaseStorage.
if (($container = drupal_container()) && $container->has('keyvalue') && function_exists('db_query')) {
if ($type == 'module') {
if (empty($files[$type])) {
$files[$type] = drupal_container()->get('module_handler')->getModuleList();
}
if (isset($files[$type][$name])) {
return $files[$type][$name];
}
}
try {
$file_list = state()->get('system.' . $type . '.files');
if ($file_list && isset($file_list[$name]) && file_exists(DRUPAL_ROOT . '/' . $file_list[$name])) {
......
......@@ -1846,7 +1846,6 @@ function install_check_translations($install_state) {
$readable = FALSE;
$writable = FALSE;
$executable = FALSE;
$files_directory = variable_get('file_public_path', conf_path() . '/files');
$translations_directory = variable_get('locale_translate_file_directory', conf_path() . '/files/translations');
$translations_directory_exists = FALSE;
......@@ -1863,7 +1862,6 @@ function install_check_translations($install_state) {
if (drupal_verify_install_file($translations_directory, FILE_EXIST|FILE_WRITABLE, 'dir')) {
$readable = is_readable($translations_directory);
$writable = is_writable($translations_directory);
$executable = is_executable($translations_directory);
$translations_directory_exists = TRUE;
}
......@@ -1934,15 +1932,6 @@ function install_check_translations($install_state) {
'value' => st('The translations directory is writable.'),
);
}
// If translations directory is not executable, throw an error.
if (!$executable) {
$requirements['translations directory executable'] = array(
'title' => st('Translations directory'),
'value' => st('The translations directory is not executable.'),
'severity' => REQUIREMENT_ERROR,
'description' => st('The installer requires execute permissions to %translations_directory during the installation process. If you are unsure how to grant file permissions, consult the <a href="@handbook_url">online handbook</a>.', array('%translations_directory' => $translations_directory, '@handbook_url' => 'http://drupal.org/server-permissions')),
);
}
}
// If the translations server can not be contacted, throw an error.
......@@ -1977,7 +1966,7 @@ function install_check_translations($install_state) {
}
}
if ($translations_directory_exists && $readable && $writable && $executable && $translation_available) {
if ($translations_directory_exists && $readable && $writable && $translation_available) {
$translation_downloaded = install_retrieve_file($translation_url, $translations_directory);
if (!$translation_downloaded) {
......
......@@ -120,11 +120,16 @@ public function check(Route $route) {
$this->loadCheck($service_id);
}
$access = $this->checks[$service_id]->access($route, $this->request);
if ($access === FALSE) {
$service_access = $this->checks[$service_id]->access($route, $this->request);
if ($service_access === FALSE) {
// A check has denied access, no need to continue checking.
$access = FALSE;
break;
}
elseif ($service_access === TRUE) {
// A check has explicitly granted access, so we need to remember that.
$access = TRUE;
}
}
// Access has been denied or not explicily approved.
......
......@@ -26,6 +26,6 @@ public function applies(Route $route) {
* Implements AccessCheckInterface::access().
*/
public function access(Route $route, Request $request) {
return $route->getRequirement('_access');
return (bool) $route->getRequirement('_access');
}
}
......@@ -7,13 +7,13 @@
namespace Drupal\openid\Tests;
use Drupal\simpletest\WebTestBase;
use Drupal\simpletest\DrupalUnitTestBase;
use stdClass;
/**
* Test internal helper functions.
*/
class OpenIDTest extends WebTestBase {
class OpenIDTest extends DrupalUnitTestBase {
/**
* Modules to enable.
......
......@@ -62,7 +62,6 @@ public function dynamicRoutes(RouteBuildEvent $event) {
// @todo Switch to ->addCollection() once http://drupal.org/node/1819018 is resolved.
foreach ($plugin->routes() as $name => $route) {
$route->setRequirement('_access', 'TRUE');
$collection->add("rest.$name", $route);
}
}
......
clear_results: '1'
die_on_fail: '0'
httpauth:
method: '1'
password: ''
......
......@@ -143,6 +143,13 @@ abstract class TestBase {
*/
protected $originalSettings;
/**
* TRUE if die on fail enabled.
*
* @var boolean
*/
protected $dieOnFail = FALSE;
/**
* Constructor for Test.
*
......@@ -223,6 +230,9 @@ protected function assert($status, $message = '', $group = 'Other', array $calle
return TRUE;
}
else {
if ($this->dieOnFail) {
exit(1);
}
return FALSE;
}
}
......@@ -660,6 +670,7 @@ public function run(array $methods = array()) {
}
$this->verboseClassName = str_replace("\\", "_", $class);
}
$this->dieOnFail = $simpletest_config->get('die_on_fail');
// HTTP auth settings (<username>:<password>) for the simpletest browser
// when sending requests to the test site.
$this->httpauth_method = (int) $simpletest_config->get('httpauth.method');
......
......@@ -616,29 +616,29 @@ protected function checkPermissions(array $permissions, $reset = FALSE) {
* $account->pass_raw = $pass_raw;
* @endcode
*
* @param $user
* @param $account
* User object representing the user to log in.
*
* @see drupalCreateUser()
*/
protected function drupalLogin($user) {
protected function drupalLogin($account) {
if ($this->loggedInUser) {
$this->drupalLogout();
}
$edit = array(
'name' => $user->name,
'pass' => $user->pass_raw
'name' => $account->name,
'pass' => $account->pass_raw
);
$this->drupalPost('user', $edit, t('Log in'));
// @see WebTestBase::drupalUserIsLoggedIn()
if (isset($this->session_id)) {
$user->session_id = $this->session_id;
$account->session_id = $this->session_id;
}
$pass = $this->assert($this->drupalUserIsLoggedIn($user), format_string('User %name successfully logged in.', array('%name' => $user->name)), 'User login');
$pass = $this->assert($this->drupalUserIsLoggedIn($account), format_string('User %name successfully logged in.', array('%name' => $account->name)), 'User login');
if ($pass) {
$this->loggedInUser = $user;
$this->loggedInUser = $account;
}
}
......
......@@ -46,5 +46,10 @@ public function testPermissionAccess() {
$this->assertResponse(200);
$this->assertNoRaw('Access denied');
$this->assertRaw('test7text', 'The correct string was returned because the route was successful.');
$this->drupalGet('router_test/test9');
$this->assertResponse(200);
$this->assertNoRaw('Access denied');
$this->assertRaw('test8', 'The correct string was returned because the route was successful.');
}
}
<?php
/**
* @file
* Contains Drupal\router_test\Access\TestAccessCheck.
*/
namespace Drupal\router_test\Access;
use Drupal\Core\Access\AccessCheckInterface;
use Symfony\Component\Routing\Route;
use Symfony\Component\HttpFoundation\Request;
/**
* Access check for test routes.
*/
class TestAccessCheck implements AccessCheckInterface {
/**
* Implements AccessCheckInterface::applies().
*/
public function applies(Route $route) {
return array_key_exists('_access_router_test', $route->getRequirements());
}
/**
* Implements AccessCheckInterface::access().
*/
public function access(Route $route, Request $request) {
// No opinion, so other access checks should decide if access should be
// allowed or not.
return NULL;
}
}
......@@ -20,5 +20,7 @@ class RouterTestBundle extends Bundle {
*/
public function build(ContainerBuilder $container) {
$container->register('router_test.subscriber', 'Drupal\router_test\RouteTestSubscriber')->addTag('event_subscriber');
$container->register('access_check.router_test', 'Drupal\router_test\Access\TestAccessCheck')
->addTag('access_check');
}
}
......@@ -45,3 +45,11 @@ router_test_8:
pattern: '/router_test/test8'
defaults:
_controller: '\Drupal\router_test\TestControllers::test8'
router_test_9:
pattern: '/router_test/test9'
defaults:
_controller: '\Drupal\router_test\TestControllers::test8'
requirements:
_permission: 'access test7'
_access_router_test: 'TRUE'
......@@ -45,7 +45,7 @@ function value_form(&$form, &$form_state) {
'#title' => t('Usernames'),
'#description' => t('Enter a comma separated list of user names.'),
'#default_value' => $default_value,
'#autocomplete_path' => 'admin/views/ajax/autocomplete/user',
'#autocomplete_path' => 'user/autocomplete/anonymous',
);
if (!empty($form_state['exposed']) && !isset($form_state['input'][$this->options['expose']['identifier']])) {
......
......@@ -176,26 +176,4 @@ public function testExposedFilter() {
}
}
/**
* Tests the autocomplete function.
*
* @see views_ajax_autocomplete_user
*/
public function testUserAutocomplete() {
module_load_include('inc', 'views', 'includes/ajax');
// Nothing should return no user.
$result = (array) json_decode(views_ajax_autocomplete_user(''));
$this->assertFalse($result);
// A random user should also not be findable.
$result = (array) json_decode(views_ajax_autocomplete_user($this->randomName())->getContent());
$this->assertFalse($result);
// A valid user should be found.
$result = (array) json_decode(views_ajax_autocomplete_user($this->names[0])->getContent());
$expected_result = array($this->names[0] => $this->names[0]);
$this->assertIdentical($result, $expected_result);
}
}
......@@ -278,53 +278,6 @@ function views_ajax_form_wrapper($form_id, &$form_state) {
return $output;
}
/**
* Page callback for views user autocomplete.
*
* @param string $string
* (optional) A comma-separated list of user names entered in the
* autocomplete form element. If not passed, it is taken from the 'q' query
* string parameter.
*
* @return Symfony\Component\HttpFoundation\JsonResponse
*/
function views_ajax_autocomplete_user($string = NULL) {
if (!isset($string)) {
$string = drupal_container()->get('request')->query->get('q');
}
// The user enters a comma-separated list of user name. We only autocomplete the last name.
$array = drupal_explode_tags($string);
// Fetch last name
$last_string = trim(array_pop($array));
$matches = array();
if ($last_string != '') {
$prefix = count($array) ? implode(', ', $array) . ', ' : '';
if (strpos('anonymous', strtolower($last_string)) !== FALSE) {
$matches[$prefix . 'Anonymous'] = 'Anonymous';
}
$result = db_select('users', 'u')
->fields('u', array('uid', 'name'))
->condition('u.name', db_like($last_string) . '%', 'LIKE')
->range(0, 10)
->execute()
->fetchAllKeyed();
foreach ($result as $account) {
$n = $account;
// Commas and quotes in terms are special cases, so encode 'em.
if (strpos($account, ',') !== FALSE || strpos($account, '"') !== FALSE) {
$n = '"' . str_replace('"', '""', $account) . '"';
}
$matches[$prefix . $n] = check_plain($account);
}