Update to Drupal 8.2.0. For more information, see https://www.drupal.org/project/drupal/releases/8.2.0
This commit is contained in:
parent
2f563ab520
commit
f1c8716f57
1732 changed files with 52334 additions and 11780 deletions
|
@ -5,7 +5,7 @@
|
|||
* Contains \Drupal\Tests\Component\Utility\ArgumentsResolverTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\Component\Utility {
|
||||
namespace Drupal\Tests\Component\Utility;
|
||||
|
||||
use Drupal\Component\Utility\ArgumentsResolver;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
@ -187,7 +187,7 @@ class ArgumentsResolverTest extends UnitTestCase {
|
|||
$data = [];
|
||||
$data[] = [function($foo) {}];
|
||||
$data[] = [[new TestClass(), 'access']];
|
||||
$data[] = ['test_access_arguments_resolver_access'];
|
||||
$data[] = ['Drupal\Tests\Component\Utility\test_access_arguments_resolver_access'];
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
@ -214,9 +214,5 @@ interface TestInterface1 {
|
|||
interface TestInterface2 {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace {
|
||||
function test_access_arguments_resolver_access($foo) {
|
||||
}
|
||||
function test_access_arguments_resolver_access($foo) {
|
||||
}
|
||||
|
|
|
@ -22,20 +22,6 @@ use Drupal\Tests\UnitTestCase;
|
|||
*/
|
||||
class SafeMarkupTest extends UnitTestCase {
|
||||
|
||||
/**
|
||||
* The error message of the last error in the error handler.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $lastErrorMessage;
|
||||
|
||||
/**
|
||||
* The error number of the last error in the error handler.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $lastErrorNumber;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -137,7 +123,7 @@ class SafeMarkupTest extends UnitTestCase {
|
|||
UrlHelper::setAllowedProtocols(['http', 'https', 'mailto']);
|
||||
|
||||
$result = SafeMarkup::format($string, $args);
|
||||
$this->assertEquals($expected, $result, $message);
|
||||
$this->assertEquals($expected, (string) $result, $message);
|
||||
$this->assertEquals($expected_is_safe, $result instanceof MarkupInterface, 'SafeMarkup::format correctly sets the result as safe or not safe.');
|
||||
|
||||
foreach ($args as $arg) {
|
||||
|
@ -171,42 +157,10 @@ class SafeMarkupTest extends UnitTestCase {
|
|||
$tests['non-url-with-colon'] = ['Hey giraffe <a href=":url">MUUUH</a>', [':url' => "llamas: they are not URLs"], 'Hey giraffe <a href=" they are not URLs">MUUUH</a>', '', TRUE];
|
||||
$tests['non-url-with-html'] = ['Hey giraffe <a href=":url">MUUUH</a>', [':url' => "<span>not a url</span>"], 'Hey giraffe <a href="<span>not a url</span>">MUUUH</a>', '', TRUE];
|
||||
|
||||
// Tests non-standard placeholders that will not replace.
|
||||
$tests['non-standard-placeholder'] = ['Hey hey', ['risky' => "<script>alert('foo');</script>"], 'Hey hey', '', TRUE];
|
||||
return $tests;
|
||||
}
|
||||
/**
|
||||
* Custom error handler that saves the last error.
|
||||
*
|
||||
* We need this custom error handler because we cannot rely on the error to
|
||||
* exception conversion as __toString is never allowed to leak any kind of
|
||||
* exception.
|
||||
*
|
||||
* @param int $error_number
|
||||
* The error number.
|
||||
* @param string $error_message
|
||||
* The error message.
|
||||
*/
|
||||
public function errorHandler($error_number, $error_message) {
|
||||
$this->lastErrorNumber = $error_number;
|
||||
$this->lastErrorMessage = $error_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* String formatting with SafeMarkup::format() and an unsupported placeholder.
|
||||
*
|
||||
* When you call SafeMarkup::format() with an unsupported placeholder, an
|
||||
* InvalidArgumentException should be thrown.
|
||||
*/
|
||||
public function testUnexpectedFormat() {
|
||||
|
||||
// We set a custom error handler because of https://github.com/sebastianbergmann/phpunit/issues/487
|
||||
set_error_handler([$this, 'errorHandler']);
|
||||
// We want this to trigger an error.
|
||||
$error = SafeMarkup::format('Broken placeholder: ~placeholder', ['~placeholder' => 'broken'])->__toString();
|
||||
restore_error_handler();
|
||||
|
||||
$this->assertEquals(E_USER_ERROR, $this->lastErrorNumber);
|
||||
$this->assertEquals('Invalid placeholder (~placeholder) in string: Broken placeholder: ~placeholder', $this->lastErrorMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -505,6 +505,18 @@ class XssTest extends UnitTestCase {
|
|||
'Image tag with alt and title attribute',
|
||||
array('img')
|
||||
),
|
||||
array(
|
||||
'<a href="https://www.drupal.org/" rel="dc:publisher">Drupal</a>',
|
||||
'<a href="https://www.drupal.org/" rel="dc:publisher">Drupal</a>',
|
||||
'Link tag with rel attribute',
|
||||
array('a')
|
||||
),
|
||||
array(
|
||||
'<span property="dc:subject">Drupal 8: The best release ever.</span>',
|
||||
'<span property="dc:subject">Drupal 8: The best release ever.</span>',
|
||||
'Span tag with property attribute',
|
||||
array('span')
|
||||
),
|
||||
array(
|
||||
'<img src="http://example.com/foo.jpg" data-caption="Drupal 8: The best release ever.">',
|
||||
'<img src="http://example.com/foo.jpg" data-caption="Drupal 8: The best release ever.">',
|
||||
|
|
Reference in a new issue