3 use Wikimedia\TestingAccessWrapper
;
6 * @covers ChangesListFilter
8 class ChangesListFilterTest
extends MediaWikiTestCase
{
11 public function setUp() {
12 $this->group
= $this->getGroup( [ 'name' => 'group' ] );
17 protected function getGroup( $groupDefinition ) {
18 return new MockChangesListFilterGroup(
20 'isFullCoverage' => true,
21 'type' => 'some_type',
29 * phpcs:disable Generic.Files.LineLength
30 * @expectedException MWException
31 * @expectedExceptionMessage Filter names may not contain '_'. Use the naming convention: 'lowercase'
34 public function testReservedCharacter() {
35 $filter = new MockChangesListFilter(
37 'group' => $this->group
,
38 'name' => 'some_name',
45 * @expectedException MWException
46 * @expectedExceptionMessage Two filters in a group cannot have the same name: 'somename'
48 public function testDuplicateName() {
49 new MockChangesListFilter(
51 'group' => $this->group
,
57 new MockChangesListFilter(
59 'group' => $this->group
,
67 * @expectedException MWException
68 * @expectedExceptionMessage Supersets can only be defined for filters in the same group
70 public function testSetAsSupersetOf() {
71 $groupA = $this->getGroup(
85 $groupB = $this->getGroup(
96 $foo = TestingAccessWrapper
::newFromObject( $groupA->getFilter( 'foo' ) );
98 $bar = $groupA->getFilter( 'bar' );
100 $baz = $groupB->getFilter( 'baz' );
102 $foo->setAsSupersetOf( $bar );
103 $this->assertArrayEquals( [
110 /** ordered= */ false,
114 $foo->setAsSupersetOf( $baz );