2017-09-01 02:06:29 +02:00
|
|
|
<?php
|
|
|
|
|
2017-09-14 07:16:05 +02:00
|
|
|
namespace SilverStripe\Blog\Tests;
|
|
|
|
|
|
|
|
use SilverStripe\Core\Config\Config;
|
|
|
|
use SilverStripe\Dev\FunctionalTest;
|
|
|
|
use SilverStripe\i18n\i18n;
|
|
|
|
use SilverStripe\View\Parsers\URLSegmentFilter;
|
|
|
|
|
2017-09-01 02:06:29 +02:00
|
|
|
class BlogFunctionalTest extends FunctionalTest
|
|
|
|
{
|
|
|
|
protected static $fixture_file = 'BlogFunctionalTest.yml';
|
|
|
|
|
|
|
|
protected static $use_draft_site = true;
|
|
|
|
|
2017-09-14 07:16:05 +02:00
|
|
|
protected function setUp()
|
2017-09-01 02:06:29 +02:00
|
|
|
{
|
2017-09-14 07:16:05 +02:00
|
|
|
Config::modify()->set(URLSegmentFilter::class, 'default_allow_multibyte', true);
|
|
|
|
i18n::set_locale('fa_IR');
|
2017-09-01 02:06:29 +02:00
|
|
|
|
|
|
|
parent::setUp();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testBlogWithMultibyteUrl()
|
|
|
|
{
|
2019-02-05 14:50:21 +01:00
|
|
|
$result = $this->get(rawurlencode('آبید'));
|
2017-09-01 02:06:29 +02:00
|
|
|
|
|
|
|
$this->assertEquals(200, $result->getStatusCode());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testMemberProfileWithMultibyteUrlAndName()
|
|
|
|
{
|
2019-02-05 14:50:21 +01:00
|
|
|
$result = $this->get(rawurlencode('آبید') . '/profile/' . rawurlencode('عبّاس-آبان'));
|
2017-09-01 02:06:29 +02:00
|
|
|
|
|
|
|
$this->assertEquals(200, $result->getStatusCode());
|
|
|
|
$this->assertContains('My Blog Post', $result->getBody());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testMemberProfileWithMultibyteUrlAndEnglishName()
|
|
|
|
{
|
2019-02-05 14:50:21 +01:00
|
|
|
$result = $this->get(rawurlencode('آبید') . '/profile/bob-jones');
|
2017-09-01 02:06:29 +02:00
|
|
|
|
|
|
|
$this->assertEquals(200, $result->getStatusCode());
|
|
|
|
$this->assertContains('My Blog Post', $result->getBody());
|
|
|
|
}
|
|
|
|
}
|