Skip to content
Snippets Groups Projects
Verified Commit dfa7222a authored by Dave Long's avatar Dave Long
Browse files

Issue #3406024 by neclimdul, mondrake, Spokje, smustgrave:...

Issue #3406024 by neclimdul, mondrake, Spokje, smustgrave: DependencySerializationTrait depends on removed __PHPUNIT_BOOTSTRAP global

(cherry picked from commit 24f8f3c9)
parent 7fa87dc4
Branches
Tags
30 merge requests!122353526426-warning-for-missing,!12212Issue #3445525 by alexpott, japerry, catch, mglaman, longwave: Add BC layer...,!11958Issue #3490507 by alexpott, smustgrave: Fix bogus mocking in...,!11769Issue #3517987: Add option to contextual filters to encode slashes in query parameter.,!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9944Issue #3483353: Consider making the createCopy config action optionally fail...,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!9526Issue #3458177 by mondrake, catch, quietone, godotislate, longwave, larowlan,...,!8738Issue #3424162 by camilledavis, dineshkumarbollu, smustgrave: Claro...,!8704Make greek characters available in ckeditor5,!8597Draft: Issue #3442259 by catch, quietone, dww: Reduce time of Migrate Upgrade tests...,!8533Issue #3446962 by kim.pepper: Remove incorrectly added...,!8517Issue #3443748 by NexusNovaz, smustgrave: Testcase creates false positive,!8325Update file Sort.php,!8095Expose document root on install,!7930Resolve #3427374 "Taxonomytid viewsargumentdefault plugin",!7627Issue #3439440 by nicxvan, Binoli Lalani, longwave: Remove country support from DateFormatter,!7445Issue #3440169: When using drupalGet(), provide an associative array for $headers,!7401#3271894 Fix documented StreamWrapperInterface return types for realpath() and dirname(),!7384Add constraints to system.advisories,!7078Issue #3320569 by Spokje, mondrake, smustgrave, longwave, quietone, Lendude,...,!6622Issue #2559833 by piggito, mohit_aghera, larowlan, guptahemant, vakulrai,...,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #109202 passed with warnings
Pipeline: drupal

#109213

    Pipeline: drupal

    #109210

      Pipeline: drupal

      #109206

        ......@@ -72,29 +72,13 @@ public function __sleep() {
        */
        #[\ReturnTypeWillChange]
        public function __wakeup() {
        // Tests in isolation potentially unserialize in the parent process.
        $phpunit_bootstrap = isset($GLOBALS['__PHPUNIT_BOOTSTRAP']);
        if ($phpunit_bootstrap && !\Drupal::hasContainer()) {
        return;
        }
        $container = \Drupal::getContainer();
        foreach ($this->_serviceIds as $key => $service_id) {
        // In rare cases, when test data is serialized in the parent process,
        // there is a service container but it doesn't contain all expected
        // services. To avoid fatal errors during the wrap-up of failing tests, we
        // check for this case, too.
        if ($phpunit_bootstrap && !$container->has($service_id)) {
        continue;
        }
        $this->$key = $container->get($service_id);
        }
        $this->_serviceIds = [];
        // In rare cases, when test data is serialized in the parent process, there
        // is a service container but it doesn't contain all expected services. To
        // avoid fatal errors during the wrap-up of failing tests, we check for this
        // case, too.
        if ($this->_entityStorages && (!$phpunit_bootstrap || $container->has('entity_type.manager'))) {
        if ($this->_entityStorages) {
        /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
        $entity_type_manager = $container->get('entity_type.manager');
        foreach ($this->_entityStorages as $key => $entity_type_id) {
        ......
        <?php
        declare(strict_types=1);
        namespace Drupal\Tests\views_ui\Kernel;
        use Drupal\KernelTests\KernelTestBase;
        use Drupal\views\Entity\View;
        use Drupal\views\ViewExecutable;
        use Drupal\views_ui\ViewUI;
        /**
        * @group views_ui
        */
        class ViewsUiObjectTest extends KernelTestBase {
        /**
        * Modules to enable.
        *
        * @var array
        */
        protected static $modules = ['views', 'views_ui'];
        /**
        * Tests serialization of the ViewUI object.
        */
        public function testSerialization(): void {
        $storage = new View([], 'view');
        $executable = $this->getMockBuilder(ViewExecutable::class)
        ->disableOriginalConstructor()
        ->setConstructorArgs([$storage])
        ->getMock();
        $storage->set('executable', $executable);
        $view_ui = new ViewUI($storage);
        // Make sure the executable is returned before serializing.
        $this->assertInstanceOf(ViewExecutable::class, $view_ui->getExecutable());
        $serialized = serialize($view_ui);
        // Make sure the ViewExecutable class is not found in the serialized string.
        $this->assertStringNotContainsString('"Drupal\views\ViewExecutable"', $serialized);
        $unserialized = unserialize($serialized);
        $this->assertInstanceOf(ViewUI::class, $unserialized);
        // Ensure serialization magic repopulated the object with the executable.
        $this->assertInstanceOf(ViewExecutable::class, $unserialized->getExecutable());
        }
        }
        ......@@ -7,7 +7,6 @@
        use Drupal\Core\Language\LanguageInterface;
        use Drupal\Core\TempStore\Lock;
        use Drupal\Tests\UnitTestCase;
        use Drupal\views\Entity\View;
        use Drupal\views_ui\ViewUI;
        use Symfony\Component\DependencyInjection\ContainerBuilder;
        ......@@ -20,7 +19,7 @@ class ViewUIObjectTest extends UnitTestCase {
        /**
        * Tests entity method decoration.
        */
        public function testEntityDecoration() {
        public function testEntityDecoration(): void {
        $method_args = [];
        $method_args['setOriginalId'] = [12];
        $method_args['setStatus'] = [TRUE];
        ......@@ -74,8 +73,10 @@ public function testEntityDecoration() {
        /**
        * Tests the isLocked method.
        *
        * @runInSeparateProcess
        */
        public function testIsLocked() {
        public function testIsLocked(): void {
        $storage = $this->getMockBuilder('Drupal\views\Entity\View')
        ->setConstructorArgs([[], 'view'])
        ->getMock();
        ......@@ -108,33 +109,8 @@ public function testIsLocked() {
        $view_ui->setLock($lock);
        $this->assertFalse($view_ui->isLocked());
        $view_ui->unsetLock(NULL);
        $view_ui->unsetLock();
        $this->assertFalse($view_ui->isLocked());
        }
        /**
        * Tests serialization of the ViewUI object.
        */
        public function testSerialization() {
        $storage = new View([], 'view');
        $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
        ->disableOriginalConstructor()
        ->setConstructorArgs([$storage])
        ->getMock();
        $storage->set('executable', $executable);
        $view_ui = new ViewUI($storage);
        // Make sure the executable is returned before serializing.
        $this->assertInstanceOf('Drupal\views\ViewExecutable', $view_ui->getExecutable());
        $serialized = serialize($view_ui);
        // Make sure the ViewExecutable class is not found in the serialized string.
        $this->assertStringNotContainsString('"Drupal\views\ViewExecutable"', $serialized);
        $unserialized = unserialize($serialized);
        $this->assertInstanceOf('Drupal\views_ui\ViewUI', $unserialized);
        }
        }
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment