Completed
Push — master ( de0e8e...6527cb )
by Robbie
01:39
created

BlogFunctionalTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 37
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A testBlogWithMultibyteUrl() 0 6 1
A testMemberProfileWithMultibyteUrlAndName() 0 7 1
A testMemberProfileWithMultibyteUrlAndEnglishName() 0 7 1
1
<?php
2
3
namespace SilverStripe\Blog\Tests;
4
5
use SilverStripe\Core\Config\Config;
6
use SilverStripe\Dev\FunctionalTest;
7
use SilverStripe\i18n\i18n;
8
use SilverStripe\View\Parsers\URLSegmentFilter;
9
10
class BlogFunctionalTest extends FunctionalTest
11
{
12
    protected static $fixture_file = 'BlogFunctionalTest.yml';
13
14
    protected static $use_draft_site = true;
15
16
    protected function setUp()
17
    {
18
        Config::modify()->set(URLSegmentFilter::class, 'default_allow_multibyte', true);
19
        i18n::set_locale('fa_IR');
20
21
        parent::setUp();
22
    }
23
24
    public function testBlogWithMultibyteUrl()
25
    {
26
        $result = $this->get('آبید');
27
28
        $this->assertEquals(200, $result->getStatusCode());
29
    }
30
31
    public function testMemberProfileWithMultibyteUrlAndName()
32
    {
33
        $result = $this->get('آبید/profile/عبّاس-آبان');
34
35
        $this->assertEquals(200, $result->getStatusCode());
36
        $this->assertContains('My Blog Post', $result->getBody());
37
    }
38
39
    public function testMemberProfileWithMultibyteUrlAndEnglishName()
40
    {
41
        $result = $this->get('آبید/profile/bob-jones');
42
43
        $this->assertEquals(200, $result->getStatusCode());
44
        $this->assertContains('My Blog Post', $result->getBody());
45
    }
46
}
47