Debian Codegraph @

tests/phpunit/unit/includes/actions/ActionInfoTest.php

raw symbols SCIP
1 <?php
2
3 use MediaWiki\Actions\ActionInfo;
4
5 /**
6 * @covers \MediaWiki\Actions\ActionInfo
7 *
8 * @author Daniel Kinzler
9 */
10 class ActionInfoTest extends MediaWikiUnitTestCase {
11
12 public static function provideSpec() {
13 yield 'true values' => [ [
14 'name' => 'testing',
15 'restriction' => 'foo',
16 'requiresUnblock' => true,
17 'requiresWrite' => true,
18 'needsReadRights' => true,
19 ] ];
20
21 yield 'false values' => [ [
22 'name' => 'testing',
23 'restriction' => null,
24 'requiresUnblock' => false,
25 'requiresWrite' => false,
26 'needsReadRights' => false,
27 ] ];
28 }
29
30 /**
31 * @dataProvider provideSpec
32 */
33 public function testGetters( array $spec ) {
34 $info = new ActionInfo( $spec );
35
36 $this->assertSame( $spec['name'], $info->getName() );
37 $this->assertSame( $spec['restriction'], $info->getRestriction() );
38 $this->assertSame( $spec['requiresUnblock'], $info->requiresUnblock() );
39 $this->assertSame( $spec['requiresWrite'], $info->requiresWrite() );
40 $this->assertSame( $spec['needsReadRights'], $info->needsReadRights() );
41 }
42
43 }