-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
493 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
client/tests/phpunit/unit/includes/ServiceWiring/TermsDomainDbFactoryTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
declare( strict_types = 1 ); | ||
|
||
namespace Wikibase\Client\Tests\Unit\ServiceWiring; | ||
|
||
use Wikibase\Client\Tests\Unit\ServiceWiringTestCase; | ||
use Wikibase\Lib\Rdbms\RepoDomainDbFactory; | ||
use Wikibase\Lib\Rdbms\TermsDomainDbFactory; | ||
|
||
/** | ||
* @coversNothing | ||
* | ||
* @group Wikibase | ||
* | ||
* @license GPL-2.0-or-later | ||
*/ | ||
class TermsDomainDbFactoryTest extends ServiceWiringTestCase { | ||
|
||
public function testConstruction() { | ||
$this->mockService( 'WikibaseClient.RepoDomainDbFactory', $this->createStub( RepoDomainDbFactory::class ) ); | ||
|
||
$this->assertInstanceOf( | ||
TermsDomainDbFactory::class, | ||
$this->getService( 'WikibaseClient.TermsDomainDbFactory' ) | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare( strict_types=1 ); | ||
|
||
namespace Wikibase\Lib\Rdbms; | ||
|
||
use Wikimedia\Rdbms\ConnectionManager; | ||
use Wikimedia\Rdbms\ILoadBalancer; | ||
|
||
/** | ||
* Database abstraction to access terms (labels, descriptions, aliases) database tables created by the WikibaseRepository extension. | ||
* (This access may happen in repo, client, or lib.) | ||
* | ||
* The underlying database is either the same as {@link RepoDomainDb}, or a dedicated virtual domain database. | ||
* | ||
* @license GPL-2.0-or-later | ||
*/ | ||
class TermsDomainDb { | ||
|
||
private RepoDomainDb $repoDb; | ||
|
||
public function __construct( RepoDomainDb $repoDb ) { | ||
$this->repoDb = $repoDb; | ||
} | ||
|
||
public function connections(): ConnectionManager { | ||
return $this->repoDb->connections(); | ||
} | ||
|
||
public function replication(): ReplicationWaiter { | ||
return $this->repoDb->replication(); | ||
} | ||
|
||
/** | ||
* @deprecated Don't use this unless it needs to be passed to a service we don't control | ||
*/ | ||
public function loadBalancer(): ILoadBalancer { | ||
return $this->repoDb->loadBalancer(); | ||
} | ||
|
||
/** | ||
* @deprecated Don't use this unless it needs to be passed to a service we don't control | ||
*/ | ||
public function domain(): string { | ||
return $this->repoDb->domain(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare( strict_types=1 ); | ||
|
||
namespace Wikibase\Lib\Rdbms; | ||
|
||
use Wikibase\DataAccess\DatabaseEntitySource; | ||
|
||
/** | ||
* @license GPL-2.0-or-later | ||
*/ | ||
class TermsDomainDbFactory { | ||
|
||
private RepoDomainDbFactory $repoDomainDbFactory; | ||
|
||
public function __construct( RepoDomainDbFactory $repoDomainDbFactory ) { | ||
$this->repoDomainDbFactory = $repoDomainDbFactory; | ||
} | ||
|
||
public function newTermsDb(): TermsDomainDb { | ||
return new TermsDomainDb( $this->repoDomainDbFactory->newRepoDb() ); | ||
} | ||
|
||
public function newForEntitySource( DatabaseEntitySource $entitySource ): TermsDomainDb { | ||
return new TermsDomainDb( $this->repoDomainDbFactory->newForEntitySource( $entitySource ) ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.