More updates to stop using dev or alpha or beta versions.
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Database / Stub / StubPDO.php
1 <?php
2
3 namespace Drupal\Tests\Core\Database\Stub;
4
5 /**
6  * A stub of \PDO for testing purposes.
7  *
8  * We override the constructor method so that PHPUnit can mock the \PDO class.
9  * \PDO itself can't be mocked, so we have to create a subclass. This subclass
10  * is being used to unit test Connection, so we don't need a functional database
11  * but we do need a mock \PDO object.
12  *
13  * @see Drupal\Tests\Core\Database\ConnectionTest
14  * @see Drupal\Core\Database\Connection
15  * @see http://stackoverflow.com/questions/3138946/mocking-the-pdo-object-using-phpunit
16  */
17 class StubPDO extends \PDO {
18
19   /**
20    * Construction method.
21    *
22    * We override this construction method with a no-op in order to mock \PDO
23    * under unit tests.
24    *
25    * @see http://stackoverflow.com/questions/3138946/mocking-the-pdo-object-using-phpunit
26    */
27   public function __construct() {
28     // No-op.
29   }
30
31 }