aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/CommentStoreCommentTest.php
diff options
context:
space:
mode:
authorLucas Werkmeister <lucas.werkmeister@wikimedia.de>2019-02-13 11:44:06 +0100
committerBrad Jorsch <bjorsch@wikimedia.org>2019-02-13 11:17:10 -0500
commitd5ed0163f25d0bb42c33b612021154daae9396af (patch)
tree137320b380dc8613d37a1e426dc702c523686ac2 /tests/phpunit/includes/CommentStoreCommentTest.php
parent4091905d5b01e26c4c8b9d790f7f06d1c0bc3180 (diff)
downloadmediawikicore-d5ed0163f25d0bb42c33b612021154daae9396af.tar.gz
mediawikicore-d5ed0163f25d0bb42c33b612021154daae9396af.zip
Fix CommentStoreComment RawMessage construction
If a CommentStoreComment is constructed without a Message argument, then the RawMessage it uses instead should specify the comment text as a plain-text parameter, not as a regular parameter: we don’t want any syntax in the text to be interpreted at the Message level. Change-Id: If14debde2bceae695c8955604ee96bd5005d8b66
Diffstat (limited to 'tests/phpunit/includes/CommentStoreCommentTest.php')
-rw-r--r--tests/phpunit/includes/CommentStoreCommentTest.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/phpunit/includes/CommentStoreCommentTest.php b/tests/phpunit/includes/CommentStoreCommentTest.php
new file mode 100644
index 000000000000..2dfe03ad6b81
--- /dev/null
+++ b/tests/phpunit/includes/CommentStoreCommentTest.php
@@ -0,0 +1,26 @@
+<?php
+
+use PHPUnit\Framework\TestCase;
+
+/**
+ * @covers CommentStoreComment
+ *
+ * @license GPL-2.0-or-later
+ */
+class CommentStoreCommentTest extends TestCase {
+
+ public function testConstructorWithMessage() {
+ $message = new Message( 'test' );
+ $comment = new CommentStoreComment( null, 'test', $message );
+
+ $this->assertSame( $message, $comment->message );
+ }
+
+ public function testConstructorWithoutMessage() {
+ $text = '{{template|param}}';
+ $comment = new CommentStoreComment( null, $text );
+
+ $this->assertSame( $text, $comment->message->text() );
+ }
+
+}