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 // @codingStandardsIgnoreStart
31 * @expectedException MWException
32 * @expectedExceptionMessage Filter names may not contain '_'. Use the naming convention: 'lowercase'
34 // @codingStandardsIgnoreEnd
35 public function testReservedCharacter() {
36 $filter = new MockChangesListFilter(
38 'group' => $this->group
,
39 'name' => 'some_name',
45 // @codingStandardsIgnoreStart
47 * @expectedException MWException
48 * @expectedExceptionMessage Two filters in a group cannot have the same name: 'somename'
50 // @codingStandardsIgnoreEnd
51 public function testDuplicateName() {
52 new MockChangesListFilter(
54 'group' => $this->group
,
60 new MockChangesListFilter(
62 'group' => $this->group
,
70 * @expectedException MWException
71 * @expectedExceptionMessage Supersets can only be defined for filters in the same group
73 public function testSetAsSupersetOf() {
74 $groupA = $this->getGroup(
88 $groupB = $this->getGroup(
99 $foo = TestingAccessWrapper
::newFromObject( $groupA->getFilter( 'foo' ) );
101 $bar = $groupA->getFilter( 'bar' );
103 $baz = $groupB->getFilter( 'baz' );
105 $foo->setAsSupersetOf( $bar );
106 $this->assertArrayEquals( [
113 /** ordered= */ false,
117 $foo->setAsSupersetOf( $baz );