3 namespace MediaWiki\Tests\Maintenance
;
8 * @covers \GetReplicaServer
12 class GetReplicaServerTest
extends MaintenanceBaseTestCase
{
14 protected function getMaintenanceClass() {
15 return GetReplicaServer
::class;
18 public function testExecuteForUnknownCluster() {
19 $this->maintenance
->setOption( 'cluster', 'invalid-cluster' );
20 $this->expectCallToFatalError();
21 $this->expectOutputRegex( "/Error: Unknown cluster 'invalid-cluster'/" );
22 $this->maintenance
->execute();
25 public function testExecute() {
26 $this->maintenance
->execute();
27 $expectedServerName = $this->getDb()->getServerName();
28 $this->expectOutputString( "$expectedServerName\n" );