BlogFunctionalTest::testBlogWithMultibyteUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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(rawurlencode('آبید'));
27
28
        $this->assertEquals(200, $result->getStatusCode());
29
    }
30
31 View Code Duplication
    public function testMemberProfileWithMultibyteUrlAndName()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
    {
33
        $result = $this->get(rawurlencode('آبید') . '/profile/' . rawurlencode('عبّاس-آبان'));
34
35
        $this->assertEquals(200, $result->getStatusCode());
36
        $this->assertContains('My Blog Post', $result->getBody());
37
    }
38
39 View Code Duplication
    public function testMemberProfileWithMultibyteUrlAndEnglishName()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
40
    {
41
        $result = $this->get(rawurlencode('آبید') . '/profile/bob-jones');
42
43
        $this->assertEquals(200, $result->getStatusCode());
44
        $this->assertContains('My Blog Post', $result->getBody());
45
    }
46
}
47