mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-18 17:21:25 +00:00
1d449787ef
Most of this code was already typed, but not everything. Using language-level type declarations allows us to remove extra PHPDoc blocks that just repeat the same information. I'm also using the more narrow UserIdentity instead of User in a few places where this is possible. Change-Id: I7661824fcb34180af1a4fd3030fcd6c0b7d34089
51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\VisualEditor\Tests;
|
|
|
|
use MediaWiki\Extension\VisualEditor\DirectParsoidClient;
|
|
use MediaWiki\Extension\VisualEditor\VisualEditorParsoidClientFactory;
|
|
use MediaWiki\Http\HttpRequestFactory;
|
|
use MediaWiki\Permissions\Authority;
|
|
use MediaWiki\Rest\Handler\Helper\PageRestHelperFactory;
|
|
use MediaWikiIntegrationTestCase;
|
|
use MultiHttpClient;
|
|
|
|
/**
|
|
* @coversDefaultClass \MediaWiki\Extension\VisualEditor\VisualEditorParsoidClientFactory
|
|
*/
|
|
class VisualEditorParsoidClientFactoryTest extends MediaWikiIntegrationTestCase {
|
|
|
|
/**
|
|
* @covers ::__construct
|
|
*/
|
|
public function testGetVisualEditorParsoidClientFactory() {
|
|
$veParsoidClientFactory = $this->getServiceContainer()
|
|
->get( VisualEditorParsoidClientFactory::SERVICE_NAME );
|
|
|
|
$this->assertInstanceOf( VisualEditorParsoidClientFactory::class, $veParsoidClientFactory );
|
|
}
|
|
|
|
private function newClientFactory(): VisualEditorParsoidClientFactory {
|
|
$httpRequestFactory = $this->createNoOpMock( HttpRequestFactory::class, [ 'createMultiClient' ] );
|
|
$httpRequestFactory->method( 'createMultiClient' )->willReturn(
|
|
$this->createNoOpMock( MultiHttpClient::class )
|
|
);
|
|
|
|
return new VisualEditorParsoidClientFactory(
|
|
$this->createNoOpMock( PageRestHelperFactory::class )
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @covers ::createParsoidClient
|
|
*/
|
|
public function testGetClient() {
|
|
$authority = $this->createNoOpMock( Authority::class );
|
|
|
|
$factory = $this->newClientFactory();
|
|
|
|
$client = $factory->createParsoidClient( $authority );
|
|
$this->assertInstanceOf( DirectParsoidClient::class, $client );
|
|
}
|
|
}
|