Completed
Push — master ( 187618...8c43e0 )
by Will
12s
created

CommentAdminTest::testGetEditForm()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 13
nc 2
nop 0
1
<?php
2
3
namespace SilverStripe\Comments\Tests;
4
5
use SilverStripe\Comments\Admin\CommentAdmin;
6
use SilverStripe\Dev\SapphireTest;
7
use SilverStripe\i18n\i18n;
8
use SilverStripe\Security\Security;
9
10
class CommentAdminTest extends SapphireTest
11
{
12
    /**
13
     * {@inheritDoc}
14
     */
15
    protected $usesDatabase = true;
16
17
    public function testProvidePermissions()
18
    {
19
        $commentAdmin = new CommentAdmin();
20
        $locale = i18n::get_locale();
21
22
        i18n::set_locale('fr');
23
        $expected = array(
24
            'CMS_ACCESS_CommentAdmin' => array(
25
                'name' => 'Accès à la section Commentaires',
26
                'category' => 'CMS Access' // missing in core
27
            )
28
        );
29
30
        $this->assertEquals($expected, $commentAdmin->providePermissions());
31
32
        i18n::set_locale($locale);
33
        $expected = array(
34
            'CMS_ACCESS_CommentAdmin' => array(
35
                'name' => 'Access to \'Comments\' section',
36
                'category' => 'CMS Access'
37
            )
38
        );
39
        $this->assertEquals($expected, $commentAdmin->providePermissions());
40
    }
41
}
42