summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Connection/ConnectionProvider.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Connection/ConnectionProvider.php')
-rw-r--r--www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Connection/ConnectionProvider.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Connection/ConnectionProvider.php b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Connection/ConnectionProvider.php
new file mode 100644
index 00000000..07efd732
--- /dev/null
+++ b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Utils/Connection/ConnectionProvider.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace SMW\Tests\Utils\Connection;
+
+use DatabaseBase;
+use SMW\Connection\ConnectionProvider as IConnectionProvider;
+
+/**
+ * @license GNU GPL v2+
+ * @since 2.0
+ *
+ * @author mwjames
+ */
+class ConnectionProvider implements IConnectionProvider {
+
+ /**
+ * @var DatabaseBase
+ */
+ protected $connection;
+
+ protected $id;
+
+ /**
+ * @since 2.0
+ *
+ * @param int $id
+ */
+ public function __construct( $id = DB_MASTER ) {
+ $this->id = $id;
+ }
+
+ /**
+ * @since 2.0
+ *
+ * @return DatabaseBase
+ */
+ public function getConnection() {
+
+ if ( $this->connection === null ) {
+ $this->connection = wfGetDB( $this->id );
+ }
+
+ return $this->connection;
+ }
+
+ public function releaseConnection() {
+ }
+
+}