| @@ 70-85 (lines=16) @@ | ||
| 67 | /** |
|
| 68 | * @see https://github.com/silverstripe/silverstripe-blog/issues/376 |
|
| 69 | */ |
|
| 70 | public function testAllowMultibyteUrlSegment() |
|
| 71 | { |
|
| 72 | /** @var Blog $blog */ |
|
| 73 | $blog = $this->objFromFixture(Blog::class, 'FirstBlog'); |
|
| 74 | ||
| 75 | $cat = new BlogCategory(); |
|
| 76 | $cat->Title = 'تست'; |
|
| 77 | $cat->write(); |
|
| 78 | ||
| 79 | ||
| 80 | // urlencoded |
|
| 81 | $this->assertEquals('%D8%AA%D8%B3%D8%AA', $cat->URLSegment); |
|
| 82 | $expectedLink = Controller::join_links($blog->Link('category'), '%D8%AA%D8%B3%D8%AA'); |
|
| 83 | $actualLink = $blog->Categories(false)->byID($cat->ID)->getLink(); |
|
| 84 | $this->assertEquals($expectedLink, $actualLink); |
|
| 85 | } |
|
| 86 | ||
| 87 | public function testCanView() |
|
| 88 | { |
|
| @@ 62-74 (lines=13) @@ | ||
| 59 | /** |
|
| 60 | * @see https://github.com/silverstripe/silverstripe-blog/issues/376 |
|
| 61 | */ |
|
| 62 | public function testAllowMultibyteUrlSegment() |
|
| 63 | { |
|
| 64 | /** @var Blog $blog */ |
|
| 65 | $blog = $this->objFromFixture(Blog::class, 'FirstBlog'); |
|
| 66 | $tag = new BlogTag(); |
|
| 67 | $tag->setBlogID($blog->ID); |
|
| 68 | $tag->Title = 'تست'; |
|
| 69 | $tag->write(); |
|
| 70 | // urlencoded |
|
| 71 | $this->assertEquals('%D8%AA%D8%B3%D8%AA', $tag->URLSegment); |
|
| 72 | $link = Controller::join_links($blog->Link(), 'tag', '%D8%AA%D8%B3%D8%AA'); |
|
| 73 | $this->assertEquals($link, $tag->getLink()); |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * The first blog can be viewed by anybody. |
|