| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Tests\Revision; |
| 4 |
|
| 5 |
use MediaWiki\Revision\FallbackSlotRoleHandler; |
| 6 |
use MediaWiki\Title\Title; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
class FallbackSlotRoleHandlerTest extends \MediaWikiUnitTestCase { |
| 13 |
|
| 14 |
public function testConstruction() { |
| 15 |
$handler = new FallbackSlotRoleHandler( 'foo' ); |
| 16 |
$this->assertSame( 'foo', $handler->getRole() ); |
| 17 |
$this->assertSame( 'slot-name-foo', $handler->getNameMessageKey() ); |
| 18 |
|
| 19 |
$title = $this->createMock( Title::class ); |
| 20 |
$this->assertSame( CONTENT_MODEL_UNKNOWN, $handler->getDefaultModel( $title ) ); |
| 21 |
|
| 22 |
$hints = $handler->getOutputLayoutHints(); |
| 23 |
$this->assertArrayHasKey( 'display', $hints ); |
| 24 |
$this->assertArrayHasKey( 'region', $hints ); |
| 25 |
$this->assertArrayHasKey( 'placement', $hints ); |
| 26 |
} |
| 27 |
|
| 28 |
public function testIsAllowedModel() { |
| 29 |
$handler = new FallbackSlotRoleHandler( 'foo' ); |
| 30 |
|
| 31 |
|
| 32 |
$title = $this->createMock( Title::class ); |
| 33 |
$this->assertFalse( $handler->isAllowedModel( 'FooModel', $title ) ); |
| 34 |
$this->assertFalse( $handler->isAllowedModel( 'QuaxModel', $title ) ); |
| 35 |
} |
| 36 |
|
| 37 |
public function testIsAllowedOn() { |
| 38 |
$handler = new FallbackSlotRoleHandler( 'foo' ); |
| 39 |
|
| 40 |
$title = $this->createMock( Title::class ); |
| 41 |
$this->assertFalse( $handler->isAllowedOn( $title ) ); |
| 42 |
} |
| 43 |
|
| 44 |
public function testSupportsArticleCount() { |
| 45 |
$handler = new FallbackSlotRoleHandler( 'foo' ); |
| 46 |
|
| 47 |
$this->assertFalse( $handler->supportsArticleCount() ); |
| 48 |
} |
| 49 |
|
| 50 |
} |