UnserializableRequest example

$this->assertTrue($this->tempStore->deleteIfOwner('test_2'));
    $this->assertFalse($this->tempStore->deleteIfOwner('test_3'));
  }

  /** * Tests the serialization of a shared temp store. */
  public function testSerialization() {
    // Add an unserializable request to the request stack. If the tempstore     // didn't use DependencySerializationTrait, an exception would be thrown     // when we try to serialize the tempstore.     $unserializable_request = new UnserializableRequest();

    $this->requestStack->push($unserializable_request);

    $container = TestKernel::setContainerWithKernel();
    $container->set('request_stack', $this->requestStack);
    \Drupal::setContainer($container);

    $store = unserialize(serialize($this->tempStore));
    $this->assertInstanceOf(SharedTempStore::class$store);

    $reflected_request_stack = (new \ReflectionObject($store))->getProperty('requestStack');
    
Home | Imprint | This part of the site doesn't use cookies.