2019-02-07 10:05:32 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Blog\Tests\Model;
|
|
|
|
|
|
|
|
use SilverStripe\Core\Config\Config;
|
|
|
|
use SilverStripe\Dev\FunctionalTest;
|
|
|
|
use SilverStripe\i18n\i18n;
|
|
|
|
use SilverStripe\View\Parsers\URLSegmentFilter;
|
|
|
|
|
|
|
|
class BlogControllerFunctionalTest extends FunctionalTest
|
|
|
|
{
|
|
|
|
protected static $fixture_file = 'BlogControllerFunctionalTest.yml';
|
|
|
|
|
2021-11-01 05:27:30 +01:00
|
|
|
protected function setUp(): void
|
2019-02-07 10:05:32 +01:00
|
|
|
{
|
|
|
|
Config::modify()->set(URLSegmentFilter::class, 'default_allow_multibyte', true);
|
|
|
|
i18n::set_locale('fa_IR');
|
|
|
|
|
|
|
|
parent::setUp();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetCategoriesWithMultibyteUrl()
|
|
|
|
{
|
2022-12-09 03:09:46 +01:00
|
|
|
$this->logInWithPermission('VIEW_DRAFT_CONTENT');
|
|
|
|
$result = $this->get('my-blog/category/' . rawurlencode('آبید') . '?stage=Stage');
|
2019-02-07 10:05:32 +01:00
|
|
|
|
|
|
|
$this->assertEquals(200, $result->getStatusCode());
|
2021-11-01 05:27:30 +01:00
|
|
|
$this->assertStringContainsString('آبید', $result->getBody());
|
2019-02-07 10:05:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetTagsWithMultibyteUrl()
|
|
|
|
{
|
2022-12-09 03:09:46 +01:00
|
|
|
$this->logInWithPermission('VIEW_DRAFT_CONTENT');
|
|
|
|
$result = $this->get('my-blog/tag/' . rawurlencode('برتراند') . '?stage=Stage');
|
2019-02-07 10:05:32 +01:00
|
|
|
|
|
|
|
$this->assertEquals(200, $result->getStatusCode());
|
2021-11-01 05:27:30 +01:00
|
|
|
$this->assertStringContainsString('برتراند', $result->getBody());
|
2019-02-07 10:05:32 +01:00
|
|
|
}
|
|
|
|
}
|