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

@ -276,7 +276,7 @@ class CssOptimizerUnitTest extends UnitTestCase {
* Tests a CSS asset with 'type' => 'external'.
*/
function testTypeExternal() {
$this->setExpectedException('Exception', 'Only file or inline CSS assets can be optimized.');
$this->setExpectedException('Exception', 'Only file CSS assets can be optimized.');
$css_asset = array(
'group' => -100,

View file

@ -61,7 +61,7 @@ class LibraryDependencyResolverTest extends UnitTestCase {
->method('getLibrariesByExtension')
->with('test')
->will($this->returnValue($this->libraryData));
$this->libraryDependencyResolver= new LibraryDependencyResolver($this->libraryDiscovery);
$this->libraryDependencyResolver = new LibraryDependencyResolver($this->libraryDiscovery);
}

View file

@ -72,11 +72,11 @@ class PercentagesTest extends UnitTestCase {
// but for the last pass through, when 500 out of 501 items have been
// processed, we do not want to round up to 100%, since that would
// erroneously indicate that the processing is complete.
array('total' => 1, 'current' => 100/501, '20'),
array('total' => 1, 'current' => 200/501, '40'),
array('total' => 1, 'current' => 300/501, '60'),
array('total' => 1, 'current' => 400/501, '80'),
array('total' => 1, 'current' => 500/501, '99.8'),
array('total' => 1, 'current' => 100 / 501, '20'),
array('total' => 1, 'current' => 200 / 501, '40'),
array('total' => 1, 'current' => 300 / 501, '60'),
array('total' => 1, 'current' => 400 / 501, '80'),
array('total' => 1, 'current' => 500 / 501, '99.8'),
);
}

View file

@ -263,7 +263,7 @@ class BazCacheContext implements CalculatedCacheContextInterface {
* {@inheritdoc}
*/
public function getContext($parameter = NULL) {
if (!is_string($parameter) || strlen($parameter) === 0) {
if (!is_string($parameter) || strlen($parameter) === 0) {
throw new \Exception();
}
return str_rot13($parameter);

View file

@ -0,0 +1,43 @@
<?php
namespace Drupal\Tests\Core\Cache\Context;
use Drupal\Core\Cache\Context\PathParentCacheContext;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
/**
* @coversDefaultClass \Drupal\Core\Cache\Context\PathParentCacheContext
* @group Cache
*/
class PathParentCacheContextTest extends UnitTestCase {
/**
* @covers ::getContext
*
* @dataProvider providerTestGetContext
*/
public function testgetContext($original_path, $context) {
$request_stack = new RequestStack();
$request = Request::create($original_path);
$request_stack->push($request);
$cache_context = new PathParentCacheContext($request_stack);
$this->assertSame($cache_context->getContext(), $context);
}
/**
* Provides a list of paths and expected cache contexts.
*/
public function providerTestGetContext() {
return [
['/some/path', 'some'],
['/some/other-path', 'some'],
['/some/other/path', 'some/other'],
['/some/other/path?q=foo&b=bar', 'some/other'],
['/some', ''],
['/', ''],
];
}
}

View file

@ -378,4 +378,3 @@ class ValidHandler implements HandlerInterface {
}
class InvalidHandler {
}

View file

@ -2,6 +2,7 @@
namespace Drupal\Tests\Core\DrupalKernel;
use Composer\Autoload\ClassLoader;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Site\Settings;
use Drupal\Tests\UnitTestCase;
@ -24,7 +25,7 @@ class DiscoverServiceProvidersTest extends UnitTestCase {
),
));
$kernel = new DrupalKernel('prod', new \Composer\Autoload\ClassLoader());
$kernel = new DrupalKernel('prod', new ClassLoader());
$kernel->discoverServiceProviders();
$expect = array(
@ -44,7 +45,7 @@ class DiscoverServiceProvidersTest extends UnitTestCase {
*/
public function testDiscoverServiceNoContainerYamls() {
new Settings([]);
$kernel = new DrupalKernel('prod', new \Composer\Autoload\ClassLoader());
$kernel = new DrupalKernel('prod', new ClassLoader());
$kernel->discoverServiceProviders();
$expect = [

View file

@ -37,12 +37,12 @@ namespace Drupal\Tests\Core\DrupalKernel {
$method = new \ReflectionMethod('Drupal\Core\DrupalKernel', 'setupTrustedHosts');
$method->setAccessible(TRUE);
$valid_host = $method->invoke(null, $request, $trusted_host_patterns);
$valid_host = $method->invoke(NULL, $request, $trusted_host_patterns);
$this->assertSame($expected, $valid_host, $message);
// Reset the trusted hosts because it is statically stored on the request.
$method->invoke(null, $request, []);
$method->invoke(NULL, $request, []);
// Reset the request factory because it is statically stored on the request.
Request::setFactory(NULL);
}
@ -144,4 +144,4 @@ namespace {
return FALSE;
}
}
}
}

View file

@ -545,7 +545,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase {
'default_langcode' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => true,
'not null' => TRUE,
),
),
'primary key' => array('id', 'langcode'),
@ -712,7 +712,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase {
'default_langcode' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => true,
'not null' => TRUE,
),
),
'primary key' => array('id', 'langcode'),
@ -750,7 +750,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase {
'default_langcode' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => true,
'not null' => TRUE,
),
),
'primary key' => array('revision_id', 'langcode'),
@ -859,51 +859,51 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase {
'bundle' => array(
'type' => 'varchar_ascii',
'length' => 128,
'not null' => true,
'not null' => TRUE,
'default' => '',
'description' => 'The field instance bundle to which this row belongs, used when deleting a field instance',
),
'deleted' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => true,
'not null' => TRUE,
'default' => 0,
'description' => 'A boolean indicating whether this data item has been deleted',
),
'entity_id' => array(
'type' => 'int',
'unsigned' => true,
'not null' => true,
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The entity id this data is attached to',
),
'revision_id' => array(
'type' => 'int',
'unsigned' => true,
'not null' => true,
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The entity revision id this data is attached to, which for an unversioned entity type is the same as the entity id',
),
'langcode' => array(
'type' => 'varchar_ascii',
'length' => 32,
'not null' => true,
'not null' => TRUE,
'default' => '',
'description' => 'The language code for this data item.',
),
'delta' => array(
'type' => 'int',
'unsigned' => true,
'not null' => true,
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The sequence number for this data item, used for multi-value fields',
),
$field_name . '_shape' => array(
'type' => 'varchar',
'length' => 32,
'not null' => false,
'not null' => FALSE,
),
$field_name . '_color' => array(
'type' => 'varchar',
'length' => 32,
'not null' => false,
'not null' => FALSE,
),
),
'primary key' => array('entity_id', 'deleted', 'delta', 'langcode'),
@ -1004,51 +1004,51 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase {
'bundle' => array(
'type' => 'varchar_ascii',
'length' => 128,
'not null' => true,
'not null' => TRUE,
'default' => '',
'description' => 'The field instance bundle to which this row belongs, used when deleting a field instance',
),
'deleted' => array(
'type' => 'int',
'size' => 'tiny',
'not null' => true,
'not null' => TRUE,
'default' => 0,
'description' => 'A boolean indicating whether this data item has been deleted',
),
'entity_id' => array(
'type' => 'varchar_ascii',
'length' => 128,
'not null' => true,
'not null' => TRUE,
'description' => 'The entity id this data is attached to',
),
'revision_id' => array(
'type' => 'varchar_ascii',
'length' => 128,
'not null' => true,
'not null' => TRUE,
'description' => 'The entity revision id this data is attached to, which for an unversioned entity type is the same as the entity id',
),
'langcode' => array(
'type' => 'varchar_ascii',
'length' => 32,
'not null' => true,
'not null' => TRUE,
'default' => '',
'description' => 'The language code for this data item.',
),
'delta' => array(
'type' => 'int',
'unsigned' => true,
'not null' => true,
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The sequence number for this data item, used for multi-value fields',
),
$field_name . '_shape' => array(
'type' => 'varchar',
'length' => 32,
'not null' => false,
'not null' => FALSE,
),
$field_name . '_color' => array(
'type' => 'varchar',
'length' => 32,
'not null' => false,
'not null' => FALSE,
),
),
'primary key' => array('entity_id', 'deleted', 'delta', 'langcode'),

View file

@ -31,7 +31,7 @@ class CustomPageExceptionHtmlSubscriberTest extends UnitTestCase {
/**
* The mocked config factory
*
* @var \Drupal\Core\Config\ConfigFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
* @var \Drupal\Core\Config\ConfigFactoryInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $configFactory;
@ -162,4 +162,3 @@ class CustomPageExceptionHtmlSubscriberTest extends UnitTestCase {
}
}

View file

@ -238,7 +238,7 @@ class ModuleHandlerTest extends UnitTestCase {
* @covers ::loadAllIncludes
*/
public function testLoadAllIncludes() {
$this->assertTrue(true);
$this->assertTrue(TRUE);
$module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandler')
->setConstructorArgs(array(
$this->root,

View file

@ -738,7 +738,7 @@ class FormBuilderTest extends FormTestBase {
*/
public function testValueCallableIsSafe($callback, $expected) {
$method = new \ReflectionMethod(FormBuilder::class, 'valueCallableIsSafe');
$method->setAccessible(true);
$method->setAccessible(TRUE);
$is_safe = $method->invoke($this->formBuilder, $callback);
$this->assertSame($expected, $is_safe);
}

View file

@ -113,7 +113,6 @@ abstract class FormTestBase extends UnitTestCase {
protected $elementInfo;
/**
*
* The event dispatcher.
*
* @var \Symfony\Component\EventDispatcher\EventDispatcherInterface|\PHPUnit_Framework_MockObject_MockObject

View file

@ -203,7 +203,7 @@ class FormValidatorTest extends UnitTestCase {
array(
array(array('test1')),
array(
'#is_button' => true,
'#is_button' => TRUE,
'#value' => 'baz',
'#name' => 'op',
'#parents' => array('submit'),

View file

@ -161,4 +161,3 @@ class NaughtyRecursiveLogger implements LoggerInterface {
$this->channel->log(rand(0, 7), $message, $context);
}
}

View file

@ -491,4 +491,3 @@ class LocalTaskManagerTest extends UnitTestCase {
}
}

View file

@ -2,8 +2,8 @@
namespace Drupal\Tests\Core\PageCache;
use Drupal\Core\PageCache\RequestPolicy\NoSessionOpen;
use Drupal\Core\PageCache\RequestPolicyInterface;
use Drupal\Core\PageCache\RequestPolicy;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\Request;
@ -29,7 +29,7 @@ class NoSessionOpenTest extends UnitTestCase {
protected function setUp() {
$this->sessionConfiguration = $this->getMock('Drupal\Core\Session\SessionConfigurationInterface');
$this->policy = new RequestPolicy\NoSessionOpen($this->sessionConfiguration);
$this->policy = new NoSessionOpen($this->sessionConfiguration);
}
/**

View file

@ -2,6 +2,7 @@
namespace Drupal\Tests\Core\ParamConverter;
use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;
use Drupal\Core\ParamConverter\EntityConverter;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\Routing\Route;
@ -116,7 +117,7 @@ class EntityConverterTest extends UnitTestCase {
$this->entityManager->expects($this->once())
->method('getStorage')
->with('invalid_id')
->willThrowException(new \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException('invalid_id'));
->willThrowException(new InvalidPluginDefinitionException('invalid_id'));
$this->entityConverter->convert('id', ['type' => 'entity:invalid_id'], 'foo', ['foo' => 'id']);
}

View file

@ -252,7 +252,7 @@ class AliasManagerTest extends UnitTestCase {
* @covers ::writeCache
*/
public function testGetAliasByPathCachedMatch() {
$path_part1 = $this->randomMachineName();
$path_part1 = $this->randomMachineName();
$path_part2 = $this->randomMachineName();
$path = '/' . $path_part1 . '/' . $path_part2;
$alias = $this->randomMachineName();

View file

@ -444,4 +444,3 @@ class PathValidatorTest extends UnitTestCase {
}
}

View file

@ -10,7 +10,7 @@ use Drupal\Tests\UnitTestCase;
*
* @group Plugin
*
* @coversDefaultClass Drupal\Core\Plugin\Context\ContextDefinition
* @coversDefaultClass \Drupal\Core\Plugin\Context\ContextDefinition
*/
class ContextDefinitionTest extends UnitTestCase {
@ -113,7 +113,7 @@ class ContextDefinitionTest extends UnitTestCase {
* @dataProvider providerGetDataDefinition
* @covers ::getDataDefinition
* @uses \Drupal
* @uses Drupal\Component\Utility\SafeMarkup
* @uses \Drupal\Component\Utility\SafeMarkup
*/
public function testGetDataDefinitionInvalidType($is_multiple) {
// Since we're trying to make getDataDefinition() throw an exception in

View file

@ -29,7 +29,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase {
/**
* Tests the getDerivativeFetcher method.
*
* @see \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDerivativeFetcher().
* @see \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDerivativeFetcher().
*/
public function testGetDerivativeFetcher() {
$definitions = array();

View file

@ -401,12 +401,12 @@ class BubbleableMetadataTest extends UnitTestCase {
* @return array
*/
public function providerTestMergeAttachmentsFeedMerging() {
$feed_a = [
$feed_a = [
'aggregator/rss',
'Feed title',
];
$feed_b = [
$feed_b = [
'taxonomy/term/1/feed',
'RSS - foo',
];
@ -533,12 +533,12 @@ class BubbleableMetadataTest extends UnitTestCase {
* @return array
*/
public function providerTestMergeAttachmentsHtmlHeadLinkMerging() {
$rel = [
$rel = [
'rel' => 'rel',
'href' => 'http://rel.example.com',
];
$shortlink = [
$shortlink = [
'rel' => 'shortlink',
'href' => 'http://shortlink.example.com',
];

View file

@ -10,9 +10,12 @@ namespace Drupal\Tests\Core\Render;
use Drupal\Component\Utility\Html;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Render\Markup;
use Drupal\Core\Render\RenderContext;
/**
* @coversDefaultClass \Drupal\Core\Render\Renderer
* @covers \Drupal\Core\Render\RenderCache
* @covers \Drupal\Core\Render\PlaceholderingRenderCache
* @group Render
*/
class RendererPlaceholdersTest extends RendererTestBase {
@ -781,6 +784,40 @@ class RendererPlaceholdersTest extends RendererTestBase {
$this->assertPlaceholderRenderCache(FALSE, [], []);
}
/**
* @covers ::render
* @covers ::doRender
* @covers \Drupal\Core\Render\RenderCache::get
* @covers \Drupal\Core\Render\PlaceholderingRenderCache::get
* @covers \Drupal\Core\Render\PlaceholderingRenderCache::set
* @covers ::replacePlaceholders
*
* @dataProvider providerPlaceholders
*/
public function testPlaceholderingDisabledForPostRequests($test_element, $args) {
$this->setUpUnusedCache();
$this->setUpRequest('POST');
$element = $test_element;
// Render without replacing placeholders, to allow this test to see which
// #attached[placeholders] there are, if any.
$this->renderer->executeInRenderContext(new RenderContext(), function () use (&$element) {
return $this->renderer->render($element);
});
// Only test cases where the placeholders have been specified manually are
// allowed to have placeholders. This means that of the different situations
// listed in providerPlaceholders(), only type B can have attached
// placeholders. Everything else, whether:
// 1. manual placeholdering
// 2. automatic placeholdering via already-present cacheability metadata
// 3. automatic placeholdering via bubbled cacheability metadata
// All three of those should NOT result in placeholders.
if (!isset($test_element['#attached']['placeholders'])) {
$this->assertFalse(isset($element['#attached']['placeholders']), 'No placeholders created.');
}
}
/**
* Tests a placeholder that adds another placeholder.
*
@ -998,7 +1035,7 @@ HTML;
$dom = Html::load($cached_element['#markup']);
$xpath = new \DOMXPath($dom);
$parent = $xpath->query('//details/summary[text()="Parent"]')->length;
$child = $xpath->query('//details/div[@class="details-wrapper"]/details/summary[text()="Child"]')->length;
$child = $xpath->query('//details/div[@class="details-wrapper"]/details/summary[text()="Child"]')->length;
$subchild = $xpath->query('//details/div[@class="details-wrapper"]/details/div[@class="details-wrapper" and text()="Subchild"]')->length;
$this->assertTrue($parent && $child && $subchild, 'The correct data is cached: the stored #markup is not affected by placeholder #lazy_builder callbacks.');

View file

@ -106,7 +106,7 @@ class RendererTestBase extends UnitTestCase {
'auto_placeholder_conditions' => [
'max-age' => 0,
'contexts' => ['session', 'user'],
'tags' => ['current-temperature'],
'tags' => ['current-temperature'],
],
];

View file

@ -101,7 +101,7 @@ class NegotiationMiddlewareTest extends UnitTestCase {
$request->setRequestFormat('html')->shouldBeCalled();
// Some getContentType calls we don't really care about but have to mock.
$request->get('ajax_iframe_upload', false)->shouldBeCalled();
$request->get('ajax_iframe_upload', FALSE)->shouldBeCalled();
$request_mock = $request->reveal();
$request_mock->query = new ParameterBag([]);
@ -126,7 +126,7 @@ class NegotiationMiddlewareTest extends UnitTestCase {
// Some calls we don't care about.
$request->setRequestFormat('html')->shouldBeCalled();
$request->get('ajax_iframe_upload', false)->shouldBeCalled();
$request->get('ajax_iframe_upload', FALSE)->shouldBeCalled();
$request_mock = $request->reveal();
$request_mock->query = new ParameterBag([]);

View file

@ -435,7 +435,7 @@ class AttributeTest extends UnitTestCase {
* The number of results that are found.
*/
protected function getXPathResultCount($query, $html) {
$document = new \DOMDocument;
$document = new \DOMDocument();
$document->loadHTML($html);
$xpath = new \DOMXPath($document);

View file

@ -315,7 +315,6 @@ class RecursiveContextualValidatorTest extends UnitTestCase {
}
/**
*
* Builds some example type data object.
*
* @return \Drupal\Core\TypedData\TypedDataInterface|\PHPUnit_Framework_MockObject_MockObject

View file

@ -512,7 +512,7 @@ class UrlTest extends UnitTestCase {
$route_match = new RouteMatch('test_route', $route, ['foo' => (object) [1]], ['foo' => 1]);
$url = Url::fromRouteMatch($route_match);
$this->assertSame('test_route', $url->getRouteName());
$this->assertEquals(['foo' => '1'] , $url->getRouteParameters());
$this->assertEquals(['foo' => '1'], $url->getRouteParameters());
}
/**

View file

@ -519,7 +519,7 @@ class LinkGeneratorTest extends UnitTestCase {
}
// Execute the query.
$document = new \DOMDocument;
$document = new \DOMDocument();
$document->loadHTML($html);
$xpath = new \DOMXPath($document);
@ -538,7 +538,7 @@ class LinkGeneratorTest extends UnitTestCase {
* The number of results that are found.
*/
protected function assertNoXPathResults($query, $html) {
$document = new \DOMDocument;
$document = new \DOMDocument();
$document->loadHTML($html);
$xpath = new \DOMXPath($document);

View file

@ -15,7 +15,7 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraintValidator
* @coversDefaultClass \Drupal\Core\Validation\Plugin\Validation\Constraint\PrimitiveTypeConstraintValidator
* @group validation
*/
class PrimitiveTypeConstraintValidatorTest extends UnitTestCase {