Passed
Branch dev (8d7b92)
by Dispositif
03:12
created

WikiBotConfigTest::provideEditionRestricted()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of dispositif/wikibot application
4
 * 2019 © Philippe M. <[email protected]>
5
 * For the full copyright and MIT license information, please view the LICENSE file.
6
 */
7
8
declare(strict_types=1);
9
10
namespace App\Application\Tests;
11
12
use App\Application\WikiBotConfig;
13
use PHPUnit\Framework\TestCase;
14
15
class WikiBotConfigTest extends TestCase
16
{
17
    /**
18
     * @dataProvider provideEditionRestricted
19
     *
20
     * @param      $bool
21
     * @param      $text
22
     * @param      $botName
23
     */
24
    public function testIsEditionRestricted($bool, $text, $botName = null)
25
    {
26
        $this::assertSame($bool, WikiBotConfig::isEditionRestricted($text, $botName));
27
    }
28
29
    public function provideEditionRestricted()
30
    {
31
        return [
32
            [false, 'bla bla'],
33
            [true, '{{Protection|blabla}} bla'],
34
            [true, '{{3R}} bla'],
35
            [true, '{{nobots}} bla'],
36
            [true, '{{bots|deny=Bob,FuBot}} bla', 'FuBot'],
37
            [false, '{{bots|deny=Bob,FuBot}} bla'],
38
        ];
39
    }
40
}
41