You are here

function NotificationsTemplatesTests::compareTexts in Notifications 6

Same name and namespace in other branches
  1. 6.4 tests/notifications_templates.test \NotificationsTemplatesTests::compareTexts()
  2. 6.2 tests/notifications_templates.test \NotificationsTemplatesTests::compareTexts()
  3. 6.3 tests/notifications_templates.test \NotificationsTemplatesTests::compareTexts()
  4. 7 tests/notifications_templates.test \NotificationsTemplatesTests::compareTexts()
1 call to NotificationsTemplatesTests::compareTexts()
NotificationsTemplatesTests::testNotificationsTemplates in tests/notifications_templates.test
Play with creating, retrieving, deleting a pair subscriptions

File

tests/notifications_templates.test, line 189

Class

NotificationsTemplatesTests
Class for testing notifications templates and message composition.

Code

function compareTexts($text1, $text2) {
  $diff = '';
  foreach ($text1 as $key => $value) {
    if (!isset($text2[$key])) {
      $diff .= "({$key})";
    }
    elseif (is_array($value)) {
      $diff .= $this
        ->compareTexts($text1[$key], $text2[$key]);
    }
    elseif ($value != $text2[$key]) {
      $diff .= "({$key}){$value}=" . $text2[$key];
    }
  }
  return $diff;
}