Upgraded drupal core with security updates
[yaffs-website] / web / core / tests / Drupal / KernelTests / Core / Database / SerializeQueryTest.php
1 <?php
2
3 namespace Drupal\KernelTests\Core\Database;
4
5 /**
6  * Tests serializing and unserializing a query.
7  *
8  * @group Database
9  */
10 class SerializeQueryTest extends DatabaseTestBase {
11   /**
12    * Confirms that a query can be serialized and unserialized.
13    */
14   public function testSerializeQuery() {
15     $query = db_select('test');
16     $query->addField('test', 'age');
17     $query->condition('name', 'Ringo');
18     // If this doesn't work, it will throw an exception, so no need for an
19     // assertion.
20     $query = unserialize(serialize($query));
21     $results = $query->execute()->fetchCol();
22     $this->assertEqual($results[0], 28, 'Query properly executed after unserialization.');
23   }
24
25 }