3 namespace Drupal\Tests\Core\Database\Stub;
6 * A stub of \PDO for testing purposes.
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.
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
17 class StubPDO extends \PDO {
20 * Construction method.
22 * We override this construction method with a no-op in order to mock \PDO
25 * @see http://stackoverflow.com/questions/3138946/mocking-the-pdo-object-using-phpunit
27 public function __construct() {