Commit 23329a96 authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-4359 (optimisations_fragile test is itself fragile)

parent 0ea75468
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -20,11 +20,13 @@ class optimisations_fragile_test_set extends cms_test_case
{
    public function testSymbols2Optimisation()
    {
        global $SYMBOLS2_CAUSE;

        require_code('site');
        $_GET['id'] = strval(db_get_first_id());
        $out = load_module_page('forum/pages/modules/forumview.php', 'forumview');
        $this->assertTrue(strpos($out->evaluate(), do_lang('DEFAULT_FORUM_TITLE')) !== false);
        $this->assertTrue(!function_exists('ecv2_MAKE_URL_ABSOLUTE'), 'symbols2.php used on forumview');
        $this->assertTrue(empty($SYMBOLS2_CAUSE), 'symbols2.php used on forumview (' . implode(', ', $SYMBOLS2_CAUSE) . ')');

        require_code('failure');
        set_throw_errors(true);
@@ -36,7 +38,7 @@ class optimisations_fragile_test_set extends cms_test_case
            }
            catch (Exception $e) {
            }
            $this->assertTrue(!function_exists('ecv2_MAKE_URL_ABSOLUTE'), 'symbols2.php used on ' . $module . ' module');
            $this->assertTrue(empty($SYMBOLS2_CAUSE), 'symbols2.php used on ' . $module . ' module (' . implode(', ', $SYMBOLS2_CAUSE) . ')');
        }
    }
}
+25 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
 */
function init__symbols()
{
    global $BLOCKS_CACHE, $PAGES_CACHE, $PANELS_CACHE, $EXTRA_SYMBOLS, $PREPROCESSABLE_SYMBOLS, $CANONICAL_URL, $STATIC_TEMPLATE_TEST_MODE;
    global $BLOCKS_CACHE, $PAGES_CACHE, $PANELS_CACHE, $EXTRA_SYMBOLS, $PREPROCESSABLE_SYMBOLS, $CANONICAL_URL, $STATIC_TEMPLATE_TEST_MODE, $SYMBOLS2_CAUSE;
    $BLOCKS_CACHE = array();
    $PAGES_CACHE = array();
    $PANELS_CACHE = array();
@@ -48,6 +48,7 @@ function init__symbols()
    $EXTRA_SYMBOLS = null;
    $CANONICAL_URL = null;
    $STATIC_TEMPLATE_TEST_MODE = false;
    $SYMBOLS2_CAUSE = array();
}

/**
@@ -116,6 +117,9 @@ function ecv($lang, $escaped, $type, $name, $param)
                } else {
                    require_code('symbols2');
                    if (function_exists('ecv2_' . $name)) {
                        global $SYMBOLS2_CAUSE;
                        $SYMBOLS2_CAUSE[] = $name;

                        $value = call_user_func('ecv2_' . $name, $lang, $escaped, $param); // A constant?
                    }
                    // Error :-(
@@ -5105,3 +5109,23 @@ function ecv_RATING($lang, $escaped, $param)
    }
    return $value;
}

/**
 * Evaluate a particular Tempcode symbol.
 *
 * @ignore
 *
 * @param  LANGUAGE_NAME $lang The language to evaluate this symbol in (some symbols refer to language elements).
 * @param  array $escaped Array of escaping operations.
 * @param  array $param Parameters to the symbol. For all but directive it is an array of strings. For directives it is an array of Tempcode objects. Actually there may be template-style parameters in here, as an influence of singular_bind and these may be Tempcode, but we ignore them.
 * @return string The result.
 */
function ecv_TAPATALK($lang, $escaped, $param)
{
    $value = (defined('IN_MOBIQUO') ? '1' : '0');

    if ($escaped !== array()) {
        apply_tempcode_escaping($escaped, $value);
    }
    return $value;
}
+0 −20
Original line number Diff line number Diff line
@@ -3488,26 +3488,6 @@ function ecv2_LOOP(&$value, $lang, $escaped, $param)
    }
}

/**
 * Evaluate a particular Tempcode symbol.
 *
 * @ignore
 *
 * @param  LANGUAGE_NAME $lang The language to evaluate this symbol in (some symbols refer to language elements).
 * @param  array $escaped Array of escaping operations.
 * @param  array $param Parameters to the symbol. For all but directive it is an array of strings. For directives it is an array of Tempcode objects. Actually there may be template-style parameters in here, as an influence of singular_bind and these may be Tempcode, but we ignore them.
 * @return string The result.
 */
function ecv2_TAPATALK($lang, $escaped, $param)
{
    $value = (defined('IN_MOBIQUO') ? '1' : '0');

    if ($escaped !== array()) {
        apply_tempcode_escaping($escaped, $value);
    }
    return $value;
}

/**
 * Evaluate a particular Tempcode symbol.
 *