diff --git a/tests/mollom.test b/tests/mollom.test index 51c3b5f..9ddb0c2 100644 --- a/tests/mollom.test +++ b/tests/mollom.test @@ -6096,3 +6096,53 @@ class MollomFlagAsInappropriateTestCase extends MollomWebTestCase { $this->assertEqual($actual, $expected, $message); } } + +/** + * Test watchdog conflict handling. + */ +class MollomWatchdogConflictingTestCase extends DrupalUnitTestCase { + + /** + * Log array to use for testing. + * + * @var array + */ + protected $log; + + public static function getInfo() { + return array( + 'name' => 'Watchdog conflict handling', + 'description' => 'Performs tests on conflict handling in _mollom_format_log.', + 'group' => 'Mollom', + ); + } + + function setUp() { + parent::setUp(); + $this->log = array( + 'severity' => 5, + 'entries' => array( + array( + 'message' => 'Spam: %teaser', + 'arguments' => array( + '%teaser' => 'spam', + ), + ), + ), + 'message' => 'Spam: %teaser', + 'arguments' => array( + '%teaser' => 'spam', + ), + ); + } + + + /** + * Tests drupal_array_diff_assoc_recursive(). + */ + public function testMollomWatchdogConflictHandling() { + $formatted_log = _mollom_format_log($this->log); + $result = array_key_exists('%teaser', $formatted_log[1]) && array_key_exists('%teaser1', $formatted_log[1]); + $this->assertTrue($result); + } +}