<?php
//how to mock our pdo constructor
class MockPDO extends PDO

{
public function __construct() {
	try 
	    {
	   		// Build PDO data source name for MySQL connection
		    $dsn = "mysql:host=localhost;dbname=baseball";

		    // Open database connection
			parent::__construct($dsn, "root", "root");	
		}
		catch (PDOException $exception) 
		{
			die($exception->getMessage());
		}

   }
}

 // Then inside your test...
 $db = $this->getMockBuilder('MockPDO')->setMethods(array('prepare'))
->getMock();
$db->expects($this->once())
->method('prepare')
->will($this->returnValue($statement));
?>