Commit 327a043d by Scott

Tests: qa_q_request

parent c0f17eb7
......@@ -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));
}
}
......@@ -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 OVEr THE LAEzy Dog';
$expected = 'The quicK ssroWn Fot jUOIps OUEr THE LAEzy Dog';
$this->assertEquals($expected, $test);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment