Update core 8.3.0

This commit is contained in:
Rob Davies 2017-04-13 15:53:35 +01:00
parent da7a7918f8
commit cd7a898e66
6144 changed files with 132297 additions and 87747 deletions

View file

@ -4,3 +4,10 @@ big_pipe_regression_test.2678662:
_controller: '\Drupal\big_pipe_regression_test\BigPipeRegressionTestController::regression2678662'
requirements:
_access: 'TRUE'
big_pipe_regression_test.2802923:
path: '/big_pipe_regression_test/2802923'
defaults:
_controller: '\Drupal\big_pipe_regression_test\BigPipeRegressionTestController::regression2802923'
requirements:
_access: 'TRUE'

View file

@ -17,4 +17,30 @@ class BigPipeRegressionTestController {
];
}
/**
* @see \Drupal\Tests\big_pipe\FunctionalJavascript\BigPipeRegressionTest::testMultipleBodies_2678662()
*/
public function regression2802923() {
return [
'#prefix' => BigPipeMarkup::create('<p>Hi, my train will arrive at '),
'time' => [
'#lazy_builder' => [static::class . '::currentTime', []],
'#create_placeholder' => TRUE,
],
'#suffix' => BigPipeMarkup::create(' — will I still be able to catch the connection to the center?</p>'),
];
}
/**
* #lazy_builder callback; builds <time> markup with current time.
*
* @return array
*/
public static function currentTime() {
return [
'#markup' => '<time datetime="' . date('Y-m-d', time()) . '"></time>',
'#cache' => ['max-age' => 0]
];
}
}

View file

@ -14,13 +14,19 @@ class BigPipeTestController {
* @return array
*/
public function test() {
$has_session = \Drupal::service('session_configuration')->hasSession(\Drupal::requestStack()->getMasterRequest());
$build = [];
$cases = BigPipePlaceholderTestCases::cases(\Drupal::getContainer());
// 1. HTML placeholder: status messages. Drupal renders those automatically,
// so all that we need to do in this controller is set a message.
drupal_set_message('Hello from BigPipe!');
if ($has_session) {
// Only set a message if a session already exists, otherwise we always
// trigger a session, which means we can't test no-session requests.
drupal_set_message('Hello from BigPipe!');
}
$build['html'] = $cases['html']->renderArray;
// 2. HTML attribute value placeholder: form action.
@ -98,7 +104,10 @@ class BigPipeTestController {
public static function helloOrYarhar() {
return [
'#markup' => BigPipeMarkup::create('<marquee>Yarhar llamas forever!</marquee>'),
'#cache' => ['max-age' => 0],
'#cache' => [
'max-age' => 0,
'tags' => ['cache_tag_set_in_lazy_builder'],
],
];
}

View file

@ -20,14 +20,14 @@ class BigPipeTestForm extends FormBase {
public function buildForm(array $form, FormStateInterface $form_state) {
$form['#token'] = FALSE;
$form['big_pipe'] = array(
$form['big_pipe'] = [
'#type' => 'checkboxes',
'#title' => $this->t('BigPipe works…'),
'#options' => [
'js' => $this->t('… with JavaScript'),
'nojs' => $this->t('… without JavaScript'),
],
);
];
return $form;
}

View file

@ -184,4 +184,16 @@ JS;
}
}
/**
* Ensure default BigPipe placeholder HTML cannot split paragraphs.
*
* @see https://www.drupal.org/node/2802923
*/
public function testPlaceholderInParagraph_2802923() {
$this->drupalLogin($this->drupalCreateUser());
$this->drupalGet(Url::fromRoute('big_pipe_regression_test.2802923'));
$this->assertJsCondition('document.querySelectorAll(\'p\').length === 1');
}
}

View file

@ -28,17 +28,16 @@ class BigPipeResponseAttachmentsProcessorTest extends UnitTestCase {
* @covers ::processAttachments
*
* @dataProvider nonHtmlResponseProvider
*
* @expectedException \AssertionError
*/
public function testNonHtmlResponse($response_class) {
$big_pipe_response_attachments_processor = $this->createBigPipeResponseAttachmentsProcessor($this->prophesize(AttachmentsResponseProcessorInterface::class));
$non_html_response = new $response_class();
$this->setExpectedException(\AssertionError::class);
$big_pipe_response_attachments_processor->processAttachments($non_html_response);
}
function nonHtmlResponseProvider() {
public function nonHtmlResponseProvider() {
return [
'AjaxResponse, which implements AttachmentsInterface' => [AjaxResponse::class],
'A dummy that implements AttachmentsInterface' => [get_class($this->prophesize(AttachmentsInterface::class)->reveal())],
@ -51,7 +50,7 @@ class BigPipeResponseAttachmentsProcessorTest extends UnitTestCase {
* @dataProvider attachmentsProvider
*/
public function testHtmlResponse(array $attachments) {
$big_pipe_response = new BigPipeResponse('original');
$big_pipe_response = new BigPipeResponse(new HtmlResponse('original'));
$big_pipe_response->setAttachments($attachments);
// This mock is the main expectation of this test: verify that the decorated