class SerializeQueryTest in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Database/SerializeQueryTest.php \Drupal\KernelTests\Core\Database\SerializeQueryTest
- 9 core/tests/Drupal/KernelTests/Core/Database/SerializeQueryTest.php \Drupal\KernelTests\Core\Database\SerializeQueryTest
Tests serializing and unserializing a query.
@group Database
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, ConfigTestTrait, ExtensionListTestTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\KernelTests\Core\Database\DatabaseTestBase
- class \Drupal\KernelTests\Core\Database\SerializeQueryTest
- class \Drupal\KernelTests\Core\Database\DatabaseTestBase
Expanded class hierarchy of SerializeQueryTest
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ SerializeQueryTest.php, line 10
Namespace
Drupal\KernelTests\Core\DatabaseView source
class SerializeQueryTest extends DatabaseTestBase {
/**
* Confirms that a query can be serialized and unserialized.
*/
public function testSerializeQuery() {
$query = $this->connection
->select('test');
$query
->addField('test', 'age');
$query
->condition('name', 'Ringo');
// If this doesn't work, it will throw an exception, so no need for an
// assertion.
$query = unserialize(serialize($query));
$results = $query
->execute()
->fetchCol();
$this
->assertEquals(28, $results[0], 'Query properly executed after unserialization.');
}
}