-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX Encode URLSegment to support multibyte member profile URLs
- Loading branch information
1 parent
a212db3
commit 2631175
Showing
4 changed files
with
76 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
class BlogFunctionalTest extends FunctionalTest | ||
{ | ||
protected static $fixture_file = 'BlogFunctionalTest.yml'; | ||
|
||
protected static $use_draft_site = true; | ||
|
||
public function setUp() | ||
{ | ||
Config::inst()->update('URLSegmentFilter', 'default_allow_multibyte', true); | ||
|
||
parent::setUp(); | ||
|
||
i18n::set_locale('fa_IR'); | ||
} | ||
|
||
public function testBlogWithMultibyteUrl() | ||
{ | ||
$result = $this->get('آبید'); | ||
|
||
$this->assertEquals(200, $result->getStatusCode()); | ||
} | ||
|
||
public function testMemberProfileWithMultibyteUrlAndName() | ||
{ | ||
$result = $this->get('آبید/profile/عبّاس-آبان'); | ||
|
||
$this->assertEquals(200, $result->getStatusCode()); | ||
$this->assertContains('My Blog Post', $result->getBody()); | ||
} | ||
|
||
public function testMemberProfileWithMultibyteUrlAndEnglishName() | ||
{ | ||
$result = $this->get('آبید/profile/bob-jones'); | ||
|
||
$this->assertEquals(200, $result->getStatusCode()); | ||
$this->assertContains('My Blog Post', $result->getBody()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Member: | ||
member_a: | ||
FirstName: عبّاس | ||
Surname: آبان | ||
Email: foo@example.com | ||
member_b: | ||
FirstName: Bob | ||
Surname: Jones | ||
Email: bobjones@example.com | ||
|
||
Blog: | ||
blog_a: | ||
URLSegment: آبید | ||
Title: My Blog | ||
|
||
BlogPost: | ||
blogpost_a: | ||
Title: My Blog Post | ||
URLSegment: آبیدآبید | ||
PublishDate: '2017-08-01 00:00:00' | ||
Parent: =>Blog.blog_a | ||
Authors: =>Member.member_a, =>Member.member_b |