Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
327a043d
Commit
327a043d
authored
Jan 05, 2017
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests: qa_q_request
parent
c0f17eb7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
BaseTest.php
qa-tests/BaseTest.php
+21
-0
UtilStringTest.php
qa-tests/UtilStringTest.php
+2
-2
No files found.
qa-tests/BaseTest.php
View file @
327a043d
...
...
@@ -28,4 +28,25 @@ class BaseTest extends PHPUnit_Framework_TestCase
$this
->
assertSame
(
1048576
,
convert_to_bytes
(
'k'
,
1024
));
}
public
function
test__qa_q_request
()
{
// set options/lang cache to bypass database
global
$qa_options_cache
;
$title1
=
'How much wood would a woodchuck chuck if a woodchuck could chuck wood?'
;
$title2
=
'Țĥé qũīçĶ ßřǭŴƞ Ƒöŧ ǰÙƢƥş ØƯĘŕ ƬĦȨ ĿÆƶȳ Ƌơǥ'
;
$qa_options_cache
[
'q_urls_title_length'
]
=
50
;
$qa_options_cache
[
'q_urls_remove_accents'
]
=
false
;
$expected1
=
'1234/much-wood-would-woodchuck-chuck-woodchuck-could-chuck-wood'
;
$expected2
=
'5678/țĥé-qũīçķ-ßřǭŵƞ-ƒöŧ-ǰùƣƥş-øưęŕ-ƭħȩ-ŀæƶȳ-ƌơǥ'
;
$this
->
assertSame
(
$expected1
,
qa_q_request
(
1234
,
$title1
));
$this
->
assertSame
(
$expected2
,
qa_q_request
(
5678
,
$title2
));
$qa_options_cache
[
'q_urls_remove_accents'
]
=
true
;
$expected3
=
'9000/the-quick-ssrown-fot-juoips-ouer-the-laezy-dog'
;
$this
->
assertSame
(
$expected3
,
qa_q_request
(
9000
,
$title2
));
}
}
qa-tests/UtilStringTest.php
View file @
327a043d
...
...
@@ -4,7 +4,7 @@ require_once QA_INCLUDE_DIR.'util/string.php';
class
UtilStringTest
extends
PHPUnit_Framework_TestCase
{
private
$strBasic
=
'So I tied an onion to my belt, which was the style at the time.'
;
private
$strAccents
=
'Țĥé qũīçĶ ßřǭŴƞ Ƒöŧ ǰÙƢƥş Ø
ƲĘŕ Ʈ
ĦȨ ĿÆƶȳ Ƌơǥ'
;
private
$strAccents
=
'Țĥé qũīçĶ ßřǭŴƞ Ƒöŧ ǰÙƢƥş Ø
ƯĘŕ Ƭ
ĦȨ ĿÆƶȳ Ƌơǥ'
;
private
$blockWordString
=
't*d o*n b*t style'
;
public
function
test__qa_string_to_words
()
...
...
@@ -22,7 +22,7 @@ class UtilStringTest extends PHPUnit_Framework_TestCase
public
function
test__qa_string_remove_accents
()
{
$test
=
qa_string_remove_accents
(
$this
->
strAccents
);
$expected
=
'The quicK ssroWn Fot jUOIps O
V
Er THE LAEzy Dog'
;
$expected
=
'The quicK ssroWn Fot jUOIps O
U
Er THE LAEzy Dog'
;
$this
->
assertEquals
(
$expected
,
$test
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment