function SerializeQueryTest::testUnserializeQuery

Confirms that a query cannot be unserialized.

File

core/tests/Drupal/KernelTests/Core/Database/SerializeQueryTest.php, line 30

Class

SerializeQueryTest
Tests serializing and unserializing a query.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testUnserializeQuery() : void {
  $class = get_class($this->connection
    ->select('test'));
  $this->expectException(\LogicException::class);
  $this->expectExceptionMessage('Database query objects cannot be unserialized');
  unserialize(sprintf('O:%d:"%s":0:{}', strlen($class), $class));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.