/** * Constructor * * @param \PDO|\mysqli|AdapterInterface $adapter * @param string|null $schema default schema, taken from adapter if not given * @throws Exception\InvalidArgumentException for invalid connection * @throws Exception\InvalidUsageException thrown if no schema can be found. */ public function __construct($adapter, $schema = null) { if (!$adapter instanceof AdapterInterface) { try { $adapter = AdapterFactory::createAdapterFromResource($adapter); } catch (Exception\InvalidArgumentException $e) { $msg = "MysqlInformationSchema requires a valid 'mysqli', 'pdo:mysql' or AdapterInterface parameter ({$e->getMessage()})."; throw new Exception\InvalidArgumentException($msg); } } parent::__construct($adapter, $schema); $this->driver = new Mysql\MysqlDriver51($this->adapter, $this->schema); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { $this->conn = \SolubleTestFactories::getDbConnection('mysqli'); $this->adapter = AdapterFactory::createAdapterFromResource($this->conn); $this->metadata = new MysqlInformationSchema($this->conn); }