function RulesTestCase::t

Same name in other branches
  1. 8.x-3.x d7-tests/rules_test_case.test \RulesTestCase::t()

Calculates the output of t() given an array of placeholders to replace.

11 calls to RulesTestCase::t()
RulesIntegrationTestCase::testDataIntegration in tests/rules.test
Tests data integration.
RulesIntegrationTestCase::testEntityIntegration in tests/rules.test
Tests entity related integration.
RulesSchedulerTestCase::testRecursionPrevention in rules_scheduler/tests/rules_scheduler.test
Makes sure recursion prevention is working fine for scheduled rule sets.
RulesTestCase::testAbortOnNULLValues in tests/rules.test
Makes sure Rules aborts when NULL values are used.
RulesTestCase::testComponentInvocations in tests/rules.test
Tests invoking components from the action.

... See full list

File

tests/rules.test, line 37

Class

RulesTestCase
Rules test cases.

Code

public static function t($text, $strings) {
    $placeholders = array();
    foreach ($strings as $key => $string) {
        $key = !is_numeric($key) ? $key : $string;
        $placeholders['%' . $key] = drupal_placeholder($string);
    }
    return strtr($text, $placeholders);
}