mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
d1ea6bb839
Previously multibyte URLs would always work, regardless of URLSegmentFilter::$default_allow_multibyte. This change means that they will only work when the setting is enabled.
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?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';
|
|
|
|
protected static $use_draft_site = true;
|
|
|
|
protected function setUp()
|
|
{
|
|
Config::modify()->set(URLSegmentFilter::class, 'default_allow_multibyte', true);
|
|
i18n::set_locale('fa_IR');
|
|
|
|
parent::setUp();
|
|
}
|
|
|
|
public function testGetCategoriesWithMultibyteUrl()
|
|
{
|
|
$result = $this->get('my-blog/category/' . rawurlencode('آبید'));
|
|
|
|
$this->assertEquals(200, $result->getStatusCode());
|
|
$this->assertContains('آبید', $result->getBody());
|
|
}
|
|
|
|
public function testGetTagsWithMultibyteUrl()
|
|
{
|
|
$result = $this->get('my-blog/tag/' . rawurlencode('برتراند'));
|
|
|
|
$this->assertEquals(200, $result->getStatusCode());
|
|
$this->assertContains('برتراند', $result->getBody());
|
|
}
|
|
}
|