Commit 3df32886 authored by sampaioprimo's avatar sampaioprimo

backporting some fixes to the unit tests

parent 2d1d44bf
......@@ -38,7 +38,15 @@ function smarty_function_query($params, $smarty) {
} else {
// Not using _REQUEST here, because it is sometimes directly modified in scripts
if ( $request === NULL ) {
$request = array_merge($_GET, $_POST);
if (!empty($_GET) && !empty($_POST)) {
$request = array_merge($_GET, $_POST);
} else if (!empty($_GET)) {
$request = $_GET;
} else if (!empty($_POST)) {
$request = $_POST;
} else {
$request = array();
}
// Remove Xajax special arguments
foreach ( array('xjxargs', 'xjxr', 'xjx', 'xjxfun', 'xjxr') as $k ) {
......
......@@ -29,9 +29,12 @@ class MembershipTest extends TikiTestCase
$this->userlib->add_group( 'MembershipTest', '', '', 0, 0, '', '', 0, '', 0, 0, 'n', 45 );
$this->userlib->add_user( 'membershiptest_a', 'abc', '[email protected]' );
$this->userlib->add_user( 'membershiptest_b', 'abc', '[email protected]' );
$this->userlib->add_user( 'membershiptest_c', 'abc', '[email protected]' );
global $user_preferences;
$user_preferences = array();
$this->userlib->add_user('membershiptest_a', 'abc', '[email protected]');
$this->userlib->add_user('membershiptest_b', 'abc', '[email protected]');
$this->userlib->add_user('membershiptest_c', 'abc', '[email protected]');
$this->userlib->assign_user_to_group( 'membershiptest_a', 'MembershipTest' );
$this->userlib->assign_user_to_group( 'membershiptest_b', 'MembershipTest' );
......
......@@ -90,6 +90,8 @@ class Multilingual_MachineTranslation_GoogleTranslateWrapperTest extends TikiTes
* @group multilingual
*/
public function test_Google_should_not_translate_html_syntax() {
$this->markTestSkipped('Google Translation API returning empty translations.');
$text = "<a href='blah'>Hello world</a>";
$translation = $this->translator->translateText($text);
$this->assertRegExp("/<a href='blah'>\s?Ciao mondo<\/a>/", $translation, "The translation was not correct for text: $text.");
......@@ -100,6 +102,8 @@ class Multilingual_MachineTranslation_GoogleTranslateWrapperTest extends TikiTes
* @group multilingual
*/
public function test_Google_should_not_translate_more_complicated_html() {
$this->markTestSkipped('Google Translation API returning empty translations.');
$text = "<strong><a title='refresh' accesskey='2' href='tiki-index.php?page=Hello+World'>Hello World</a></strong>";
$translation = $this->translator->translateText($text);
$this->assertEquals("<strong><a title='refresh' accesskey='2' href='tiki-index.php?page=Hello+World'>Ciao Mondo</a></strong>", $translation, "The translation was not correct for text: $text.");
......@@ -110,6 +114,8 @@ class Multilingual_MachineTranslation_GoogleTranslateWrapperTest extends TikiTes
* @group multilingual
*/
public function test_that_ul_tag_gets_translated_properly() {
$this->markTestSkipped('Google Translation API returning empty translations.');
$text = "<ul><li>You want to get started quickly<br /></li></ul>";
$translator = new Multilingual_MachineTranslation_GoogleTranslateWrapper('en','fr');
$translation = $translator->translateText($text);
......@@ -120,6 +126,8 @@ class Multilingual_MachineTranslation_GoogleTranslateWrapperTest extends TikiTes
* @group multilingual
*/
public function test_that_parens_stay_after_translation() {
$this->markTestSkipped('Google Translation API returning empty translations.');
$text = 'profile (<a class="wiki" href="tiki-admin.php?profile=&amp;category=Featured+profiles&amp;repository=http%3a%2f%2fprofiles.tiki.org%2fprofiles&amp;preloadlist=y&amp;page=profiles&amp;list=List#profile-results" rel="">install profile now</a>)';
$translator = new Multilingual_MachineTranslation_GoogleTranslateWrapper('en','fr');
$translation = $translator->translateText($text);
......@@ -130,6 +138,8 @@ class Multilingual_MachineTranslation_GoogleTranslateWrapperTest extends TikiTes
* @group multilingual
*/
public function test_strong_html_tag_renders_well_after_translation() {
$this->markTestSkipped('Google Translation API returning empty translations.');
$text = 'different ways to <strong>Get Started</strong> with Tiki';
$translator = new Multilingual_MachineTranslation_GoogleTranslateWrapper('en','fr');
$translation = $translator->translateText($text);
......@@ -140,6 +150,8 @@ class Multilingual_MachineTranslation_GoogleTranslateWrapperTest extends TikiTes
* @group multilingual
*/
public function test_english_one_title_gets_translated() {
$this->markTestSkipped('Google Translation API returning empty translations.');
$text = '<h3 class="showhide_heading" id="Get_Started_using_Profiles"><a class="wiki" href="tiki-admin.php?profile=&amp;category=Featured+profiles&amp;repository=http%3a%2f%2fprofiles.tiki.org%2fprofiles&amp;preloadlist=y&amp;page=profiles&amp;list=List#profile-results" rel="">Get Started using Admin Panel</a><br /></h3>';
$translator = new Multilingual_MachineTranslation_GoogleTranslateWrapper('en','fr');
$translation = $translator->translateText($text);
......@@ -151,6 +163,8 @@ class Multilingual_MachineTranslation_GoogleTranslateWrapperTest extends TikiTes
* @group multilingual
*/
public function test_english_titles_get_translated() {
$this->markTestSkipped('Google Translation API returning empty translations.');
$text = '<h3 class="showhide_heading" id="Get_Started_using_Profiles"><a class="wiki" href="tiki-admin.php?profile=&amp;category=Featured+profiles&amp;repository=http%3a%2f%2fprofiles.tiki.org%2fprofiles&amp;preloadlist=y&amp;page=profiles&amp;list=List#profile-results" rel="">Get Started using Admin Panel</a><br /></h3><h3 class="showhide_heading" id="Get_Started_using_Profiles"><a class="wiki" href="tiki-admin.php?profile=&amp;category=Featured+profiles&amp;repository=http%3a%2f%2fprofiles.tiki.org%2fprofiles&amp;preloadlist=y&amp;page=profiles&amp;list=List#profile-results" rel="">Get Started using Profiles</a><br /></h3>';
$translator = new Multilingual_MachineTranslation_GoogleTranslateWrapper('en','fr');
$translation = $translator->translateText($text);
......
......@@ -3,7 +3,6 @@
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
$lang = array(
// "Bytecode Cache" => "Bytecode Cache",
......
......@@ -3,7 +3,6 @@
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
$lang = array(
// "Bytecode Cache" => "Bytecode Cache",
......
......@@ -20,8 +20,8 @@ class WikiPlugin_CodeTest extends PHPUnit_Framework_TestCase
public function provider()
{
return array(
array('', '<pre class="codelisting" dir="ltr" style="overflow:auto;" id="codebox1" >~np~~/np~</pre>'),
array('<script>alert(document.cookie);</script>', '<pre class="codelisting" dir="ltr" style="overflow:auto;" id="codebox2" >~np~<script>alert(document.cookie);</script>~/np~</pre>', array('ishtml' => 1)),
array('', '<pre class="codelisting" data-wrap="y" dir="ltr" id="codebox1" >~np~~/np~</pre>'),
array('<script>alert(document.cookie);</script>', '<pre class="codelisting" data-wrap="y" dir="ltr" id="codebox2" >~np~<script>alert(document.cookie);</script>~/np~</pre>', array('ishtml' => 1)),
);
}
}
......@@ -95,11 +95,14 @@ function wikiplugin_code($data, $params) {
. (isset($colors) ? ' data-syntax="' . $colors . '" ' : '')
. (isset($ln) ? ' data-line-numbers="' . $ln . '" ' : '')
. (isset($wrap) ? ' data-wrap="' . $wrap . '" ' : '')
. ' dir="'.( (isset($rtl) && $rtl == 1) ? 'rtl' : 'ltr').'" style="'.$pre_style.'"'.$boxid.'>'
. ' dir="'.( (isset($rtl) && $rtl == 1) ? 'rtl' : 'ltr') . '" '
. (isset($pre_style) ? ' style="'.$pre_style.'"' : '')
. $boxid.'>'
. '~np~'
. $out
. '~/np~'
. '</pre>';
return $out;
}
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