Update to Drupal 8.0.2. For more information, see https://www.drupal.org/drupal-8.0.2-release-notes

This commit is contained in:
Pantheon Automation 2016-01-06 16:31:26 -08:00 committed by Greg Anderson
parent 1a0e9d9fac
commit a6b049dd05
538 changed files with 5247 additions and 1594 deletions

View file

@ -74,6 +74,10 @@ trait AssertConfigTrait {
}
break;
case 'Drupal\Component\Diff\Engine\DiffOpAdd':
// The _core property does not exist in the default config.
if ($op->closing[0] === '_core:') {
continue;
}
foreach ($op->closing as $closing) {
// The UUIDs don't exist in the default config.
if (strpos($closing, 'uuid: ') === 0) {

View file

@ -25,7 +25,7 @@ class CacheCollectorTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->installSchema('system', ['semaphore']);
}

View file

@ -25,7 +25,7 @@ class DrupalSetMessageTest extends KernelTestBase {
$this->assertEquals('A message: bar', (string) $messages['status'][0]);
}
public function tearDown() {
protected function tearDown() {
// Clear session to prevent global leakage.
unset($_SESSION['messages']);
parent::tearDown();

View file

@ -48,7 +48,7 @@ class StableTemplateOverrideTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->themeHandler = $this->container->get('theme_handler');

View file

@ -235,8 +235,7 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
$this->streamWrappers = array();
\Drupal::unsetContainer();
// @see /core/tests/bootstrap.php
$this->classLoader = $GLOBALS['loader'];
$this->classLoader = require $this->root . '/autoload.php';
require_once $this->root . '/core/includes/bootstrap.inc';
@ -407,7 +406,7 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
// If the test is run with argument dburl then use it.
$db_url = getenv('SIMPLETEST_DB');
if (empty($db_url)) {
$this->markTestSkipped('There is no database connection so no tests can be run. You must provide a SIMPLETEST_DB environment variable to run PHPUnit based functional tests outside of run-tests.sh. See https://www.drupal.org/node/2116263#skipped-tests for more information.');
throw new \Exception('There is no database connection so no tests can be run. You must provide a SIMPLETEST_DB environment variable to run PHPUnit based functional tests outside of run-tests.sh. See https://www.drupal.org/node/2116263#skipped-tests for more information.');
}
else {
$database = Database::convertDbUrlToConnectionInfo($db_url, $this->root);
@ -509,7 +508,7 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
];
// @todo Use extension_loaded('apcu') for non-testbot
// https://www.drupal.org/node/2447753.
if (function_exists('apc_fetch')) {
if (function_exists('apcu_fetch')) {
$configuration['default']['cache_backend_class'] = ApcuFileCacheBackend::class;
}
}
@ -787,6 +786,12 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
/**
* Enables modules for this test.
*
* To install test modules outside of the testing environment, add
* @code
* $settings['extension_discovery_scan_tests'] = TRUE;
* @encode
* to your settings.php.
*
* @param string[] $modules
* A list of modules to enable. Dependencies are not resolved; i.e.,
* multiple modules have to be specified individually. The modules are only
@ -882,7 +887,8 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
// Update the kernel to remove their services.
$this->container->get('kernel')->updateModules($module_filenames, $module_filenames);
// Ensure isLoaded() is TRUE in order to make _theme() work.
// Ensure isLoaded() is TRUE in order to make
// \Drupal\Core\Theme\ThemeManagerInterface::render() work.
// Note that the kernel has rebuilt the container; this $module_handler is
// no longer the $module_handler instance from above.
$module_handler = $this->container->get('module_handler');
@ -1116,4 +1122,22 @@ abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements Ser
}
}
/**
* Prevents serializing any properties.
*
* Kernel tests are run in a separate process. To do this PHPUnit creates a
* script to run the test. If it fails, the test result object will contain a
* stack trace which includes the test object. It will attempt to serialize
* it. Returning an empty array prevents it from serializing anything it
* should not.
*
* @return array
* An empty array.
*
* @see vendor/phpunit/phpunit/src/Util/PHP/Template/TestCaseMethod.tpl.dist
*/
public function __sleep() {
return [];
}
}

View file

@ -376,7 +376,7 @@ class DateTimePlusTest extends UnitTestCase {
// Test for invalid minute from date array.
array(array('year' => 2010, 'month' => 7, 'day' => 8, 'hour' => 8, 'minute' => 88, 'second' => 0), 'America/Chicago'),
// Regression test for https://www.drupal.org/node/2084455.
array(array('hour' => 59, 'minute' => 1,'second' => 1), 'America/Chicago'),
array(array('hour' => 59, 'minute' => 1, 'second' => 1), 'America/Chicago'),
);
}

View file

@ -49,7 +49,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
$this->machineFormat = TRUE;
$this->containerClass = '\Drupal\Component\DependencyInjection\Container';
$this->containerDefinition = $this->getMockContainerDefinition();

View file

@ -58,7 +58,7 @@ namespace Drupal\Tests\Component\DependencyInjection\Dumper {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
// Setup a mock container builder.
$this->containerBuilder = $this->prophesize('\Symfony\Component\DependencyInjection\ContainerBuilder');
$this->containerBuilder->getAliases()->willReturn(array());

View file

@ -18,7 +18,7 @@ class PhpArrayDumperTest extends OptimizedPhpArrayDumperTest {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
$this->machineFormat = FALSE;
$this->dumperClass = '\Drupal\Component\DependencyInjection\Dumper\PhpArrayDumper';
parent::setUp();

View file

@ -18,7 +18,7 @@ class PhpArrayContainerTest extends ContainerTest {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
$this->machineFormat = FALSE;
$this->containerClass = '\Drupal\Component\DependencyInjection\PhpArrayContainer';
$this->containerDefinition = $this->getMockContainerDefinition();

View file

@ -25,7 +25,7 @@ use Symfony\Component\EventDispatcher\Tests\TestEventListener;
*
* @see https://github.com/symfony/symfony/pull/12521
*
* @group Symfony
* @group EventDispatcher
*/
class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
{

View file

@ -81,7 +81,7 @@ class HtmlTest extends UnitTestCase {
// Verify that an identifier starting with two hyphens is replaced.
array('__cssidentifier', '--cssidentifier', array()),
// Verify that passing double underscores as a filter is processed.
array('_cssidentifier', '__cssidentifier', array('__' => '_')),
array('_cssidentifier', '__cssidentifier', array('__' => '_')),
);
}

View file

@ -30,7 +30,7 @@ class SortArrayTest extends UnitTestCase {
* The first input array for the SortArray::sortByWeightElement() method.
* @param array $b
* The second input array for the SortArray::sortByWeightElement().
* @param integer $expected
* @param int $expected
* The expected output from calling the method.
*/
public function testSortByWeightElement($a, $b, $expected) {
@ -106,7 +106,7 @@ class SortArrayTest extends UnitTestCase {
* The first input array for the SortArray::sortByWeightProperty() method.
* @param array $b
* The second input array for the SortArray::sortByWeightProperty().
* @param integer $expected
* @param int $expected
* The expected output from calling the method.
*/
public function testSortByWeightProperty($a, $b, $expected) {
@ -182,7 +182,7 @@ class SortArrayTest extends UnitTestCase {
* The first input item for comparison.
* @param array $b
* The second item for comparison.
* @param integer $expected
* @param int $expected
* The expected output from calling the method.
*/
public function testSortByTitleElement($a, $b, $expected) {
@ -251,7 +251,7 @@ class SortArrayTest extends UnitTestCase {
* The first input item for comparison.
* @param array $b
* The second item for comparison.
* @param integer $expected
* @param int $expected
* The expected output from calling the method.
*/
public function testSortByTitleProperty($a, $b, $expected) {

View file

@ -24,7 +24,7 @@ class UnicodeTest extends UnitTestCase {
*
* @covers ::check
*/
public function setUp() {
protected function setUp() {
// Initialize unicode component.
Unicode::check();
}

View file

@ -217,8 +217,8 @@ class AccessManagerTest extends UnitTestCase {
$this->assertEquals(TRUE, $this->accessManager->check($route_matches['test_route_4'], $this->account));
$this->assertEquals(AccessResult::neutral(), $this->accessManager->check($route_matches['test_route_1'], $this->account, NULL, TRUE));
$this->assertEquals(AccessResult::allowed(), $this->accessManager->check($route_matches['test_route_2'], $this->account, NULL, TRUE));
$this->assertEquals(AccessResult::forbidden(), $this->accessManager->check($route_matches['test_route_3'], $this->account, NULL, TRUE));
$this->assertEquals(AccessResult::allowed(), $this->accessManager->check($route_matches['test_route_4'], $this->account, NULL, TRUE));
$this->assertEquals(AccessResult::forbidden(), $this->accessManager->check($route_matches['test_route_3'], $this->account, NULL, TRUE));
$this->assertEquals(AccessResult::allowed(), $this->accessManager->check($route_matches['test_route_4'], $this->account, NULL, TRUE));
}
/**

View file

@ -97,9 +97,9 @@ class LibraryDependencyResolverTest extends UnitTestCase {
[['test/nested_deps_c'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c']],
[['test/nested_deps_a', 'test/nested_deps_b'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b']],
[['test/nested_deps_b', 'test/nested_deps_a'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b']],
[['test/nested_deps_a', 'test/nested_deps_c'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c']],
[['test/nested_deps_b', 'test/nested_deps_c'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c']],
[['test/nested_deps_c', 'test/nested_deps_a'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c']],
[['test/nested_deps_a', 'test/nested_deps_c'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c']],
[['test/nested_deps_b', 'test/nested_deps_c'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c']],
[['test/nested_deps_c', 'test/nested_deps_a'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c']],
[['test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c']],
[['test/nested_deps_a', 'test/nested_deps_c', 'test/nested_deps_b'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c']],
[['test/nested_deps_b', 'test/nested_deps_a', 'test/nested_deps_c'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c']],
@ -107,7 +107,7 @@ class LibraryDependencyResolverTest extends UnitTestCase {
[['test/nested_deps_c', 'test/nested_deps_a', 'test/nested_deps_b'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c']],
[['test/nested_deps_c', 'test/nested_deps_b', 'test/nested_deps_a'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c']],
// Complex dependencies, combining the above, with many intersections.
[['test/deps_c', 'test/nested_deps_b'], ['test/no_deps_b', 'test/no_deps_a', 'test/deps_c', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b']],
[['test/deps_c', 'test/nested_deps_b'], ['test/no_deps_b', 'test/no_deps_a', 'test/deps_c', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b']],
[['test/no_deps_a', 'test/deps_c', 'test/nested_deps_b'], ['test/no_deps_a', 'test/no_deps_b', 'test/deps_c', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b']],
[['test/nested_deps_b', 'test/deps_c', 'test/no_deps_c'], ['test/no_deps_a', 'test/deps_a', 'test/nested_deps_a', 'test/nested_deps_b', 'test/no_deps_b', 'test/deps_c', 'test/no_deps_c']],
];
@ -149,9 +149,9 @@ class LibraryDependencyResolverTest extends UnitTestCase {
[['test/nested_deps_c'], ['test/nested_deps_c']],
[['test/nested_deps_a', 'test/nested_deps_b'], ['test/nested_deps_b']],
[['test/nested_deps_b', 'test/nested_deps_a'], ['test/nested_deps_b']],
[['test/nested_deps_a', 'test/nested_deps_c'], ['test/nested_deps_c']],
[['test/nested_deps_b', 'test/nested_deps_c'], ['test/nested_deps_c']],
[['test/nested_deps_c', 'test/nested_deps_a'], ['test/nested_deps_c']],
[['test/nested_deps_a', 'test/nested_deps_c'], ['test/nested_deps_c']],
[['test/nested_deps_b', 'test/nested_deps_c'], ['test/nested_deps_c']],
[['test/nested_deps_c', 'test/nested_deps_a'], ['test/nested_deps_c']],
[['test/nested_deps_a', 'test/nested_deps_b', 'test/nested_deps_c'], ['test/nested_deps_c']],
[['test/nested_deps_a', 'test/nested_deps_c', 'test/nested_deps_b'], ['test/nested_deps_c']],
[['test/nested_deps_b', 'test/nested_deps_a', 'test/nested_deps_c'], ['test/nested_deps_c']],
@ -159,7 +159,7 @@ class LibraryDependencyResolverTest extends UnitTestCase {
[['test/nested_deps_c', 'test/nested_deps_a', 'test/nested_deps_b'], ['test/nested_deps_c']],
[['test/nested_deps_c', 'test/nested_deps_b', 'test/nested_deps_a'], ['test/nested_deps_c']],
// Complex dependencies, combining the above, with many intersections.
[['test/deps_c', 'test/nested_deps_b'], ['test/deps_c', 'test/nested_deps_b']],
[['test/deps_c', 'test/nested_deps_b'], ['test/deps_c', 'test/nested_deps_b']],
[['test/no_deps_a', 'test/deps_c', 'test/nested_deps_b'], ['test/deps_c', 'test/nested_deps_b']],
[['test/nested_deps_b', 'test/deps_c', 'test/no_deps_c'], ['test/nested_deps_b', 'test/deps_c', 'test/no_deps_c']],
];

View file

@ -56,7 +56,7 @@ class ConfigFactoryTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
$this->storage = $this->getMock('Drupal\Core\Config\StorageInterface');
$this->eventDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$this->typedConfig = $this->getMock('\Drupal\Core\Config\TypedConfigManagerInterface');

View file

@ -58,7 +58,7 @@ class ConfigTest extends UnitTestCase {
*/
protected $cacheTagsInvalidator;
public function setUp() {
protected function setUp() {
$this->storage = $this->getMock('Drupal\Core\Config\StorageInterface');
$this->eventDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
$this->typedConfig = $this->getMock('\Drupal\Core\Config\TypedConfigManagerInterface');

View file

@ -163,6 +163,7 @@ class ConfigEntityTypeTest extends UnitTestCase {
'status' => 'status',
'dependencies' => 'dependencies',
'third_party_settings' => 'third_party_settings',
'_core' => '_core',
'id' => 'id',
'custom_property' => 'customProperty',
],

View file

@ -33,7 +33,7 @@ class StackedKernelPassTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
$this->stackedKernelPass = new StackedKernelPass();
$this->containerBuilder = new ContainerBuilder();
}

View file

@ -145,7 +145,7 @@ class EntityFieldManagerTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->container = $this->prophesize(ContainerInterface::class);

View file

@ -76,13 +76,13 @@ class ModuleRouteSubscriberTest extends UnitTestCase {
return array(
array('enabled', array('_module_dependencies' => 'enabled'), FALSE),
array('disabled', array('_module_dependencies' => 'disabled'), TRUE),
array('enabled_or', array('_module_dependencies' => 'disabled,enabled'), FALSE),
array('enabled_or', array('_module_dependencies' => 'enabled,disabled'), FALSE),
array('disabled_or', array('_module_dependencies' => 'disabled,disabled'), TRUE),
array('enabled_and', array('_module_dependencies' => 'enabled+enabled'), FALSE),
array('enabled_and', array('_module_dependencies' => 'enabled+disabled'), TRUE),
array('enabled_and', array('_module_dependencies' => 'disabled+enabled'), TRUE),
array('disabled_and', array('_module_dependencies' => 'disabled+disabled'), TRUE),
array('enabled_or', array('_module_dependencies' => 'disabled,enabled'), FALSE),
array('enabled_or', array('_module_dependencies' => 'enabled,disabled'), FALSE),
array('disabled_or', array('_module_dependencies' => 'disabled,disabled'), TRUE),
array('enabled_and', array('_module_dependencies' => 'enabled+enabled'), FALSE),
array('enabled_and', array('_module_dependencies' => 'enabled+disabled'), TRUE),
array('enabled_and', array('_module_dependencies' => 'disabled+enabled'), TRUE),
array('disabled_and', array('_module_dependencies' => 'disabled+disabled'), TRUE),
array('no_dependencies', array(), FALSE),
);
}

View file

@ -33,7 +33,7 @@ class PsrResponseSubscriberTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
$factory = $this->getMock('Symfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface', [], [], '', NULL);
$factory
->expects($this->any())

View file

@ -14,8 +14,6 @@ use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\Core\Form\FormCache
* @group Form
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
*/
class FormCacheTest extends UnitTestCase {
@ -89,6 +87,16 @@ class FormCacheTest extends UnitTestCase {
*/
protected $requestPolicy;
/**
* {@inheritdoc}
*/
protected $runTestInSeparateProcess = TRUE;
/**
* {@inheritdoc}
*/
protected $preserveGlobalState = FALSE;
/**
* {@inheritdoc}
*/

View file

@ -27,7 +27,7 @@ class ClientFactoryTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
$stack = $this->getMockBuilder('GuzzleHttp\HandlerStack')
->disableOriginalConstructor()
->getMock();

View file

@ -47,7 +47,7 @@ class ImageTest extends UnitTestCase {
protected $toolkitOperation;
/**
* @inheritdoc
* {@inheritdoc}
*/
protected function setUp() {
// Use the Druplicon image.

View file

@ -32,7 +32,7 @@ class ChainRequestPolicyTest extends UnitTestCase {
*/
protected $request;
public function setUp() {
protected function setUp() {
$this->policy = new ChainRequestPolicy();
$this->request = new Request();
}

View file

@ -40,7 +40,7 @@ class ChainResponsePolicyTest extends UnitTestCase {
*/
protected $response;
public function setUp() {
protected function setUp() {
$this->policy = new ChainResponsePolicy();
$this->response = new Response();
$this->request = new Request();

View file

@ -24,7 +24,7 @@ class CommandLineOrUnsafeMethodTest extends UnitTestCase {
*/
protected $policy;
public function setUp() {
protected function setUp() {
// Note that it is necessary to partially mock the class under test in
// order to disable the isCli-check.
$this->policy = $this->getMock('Drupal\Core\PageCache\RequestPolicy\CommandLineOrUnsafeMethod', array('isCli'));

View file

@ -32,7 +32,7 @@ class NoSessionOpenTest extends UnitTestCase {
*/
protected $policy;
public function setUp() {
protected function setUp() {
$this->sessionConfiguration = $this->getMock('Drupal\Core\Session\SessionConfigurationInterface');
$this->policy = new RequestPolicy\NoSessionOpen($this->sessionConfiguration);
}

View file

@ -43,7 +43,7 @@ class ContextTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->typedDataManager = $this->getMockBuilder('Drupal\Core\TypedData\TypedDataManager')

View file

@ -49,7 +49,7 @@ class AccessAwareRouterTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
parent::setUp();
$this->route = new Route('test');
$this->accessManager = $this->getMock('Drupal\Core\Access\AccessManagerInterface');

View file

@ -32,7 +32,7 @@ class WriteSafeSessionHandlerTest extends UnitTestCase {
*/
protected $sessionHandler;
public function setUp() {
protected function setUp() {
$this->wrappedSessionHandler = $this->getMock('SessionHandlerInterface');
$this->sessionHandler = new WriteSafeSessionHandler($this->wrappedSessionHandler);
}

View file

@ -27,7 +27,7 @@ class ReverseProxyMiddlewareTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
public function setUp() {
protected function setUp() {
$this->mockHttpKernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
}

View file

@ -7,6 +7,7 @@
namespace Drupal\Tests\Core\Template;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Template\TwigSandboxPolicy;
use Drupal\Core\Template\Loader\StringLoader;
use Drupal\Tests\UnitTestCase;
@ -64,6 +65,13 @@ class TwigSandboxTest extends UnitTestCase {
];
}
/**
* Tests that white listed classes can be extended.
*/
public function testExtendedClass() {
$this->twig->render('{{ attribute.addClass("kitten") }}', ['attribute' => new TestAttribute()]);
}
/**
* Tests that prefixed methods can be called from within Twig templates.
*
@ -133,3 +141,5 @@ class TwigSandboxTest extends UnitTestCase {
}
}
class TestAttribute extends Attribute {}