Matthias Mullie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/107563


Change subject: Use PostRevisionTestCase helper method to build PostRevision 
object
......................................................................

Use PostRevisionTestCase helper method to build PostRevision object

Change-Id: I39148bc4b5fdad80bd107c7f461cc0041bc8c2b2
---
M tests/RedlinkerTest.php
1 file changed, 8 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/63/107563/1

diff --git a/tests/RedlinkerTest.php b/tests/RedlinkerTest.php
index 87f9b68..9471d9b 100644
--- a/tests/RedlinkerTest.php
+++ b/tests/RedlinkerTest.php
@@ -7,30 +7,8 @@
 use Flow\Model\PostRevision;
 use Title;
 
-class RedlinkerTest extends \MediaWikiTestCase {
-
-       // Default values for PostRevision::newFromRow to work
-       static protected $postRow = array(
-               'rev_id' => null,
-               'rev_user_id' => null,
-               'rev_user_text' => null,
-               'rev_parent_id' => null,
-               'rev_change_type' => null,
-               'rev_flags' => null,
-               'rev_content' => null,
-               'rev_mod_state' => null,
-               'rev_mod_user_id' => null,
-               'rev_mod_user_text' => null,
-               'rev_mod_timestamp' => null,
-               'tree_parent_id' => null,
-               'tree_rev_id' => null,
-               'tree_rev_descendant_id' => null,
-               'tree_orig_create_time' => null,
-               'tree_orig_user_id' => null,
-               'tree_orig_user_text' => null,
-       );
-
-   static public function redLinkProvider() {
+class RedlinkerTest extends PostRevisionTestCase {
+       static public function redLinkProvider() {
                return array(
                        array(
                                'Basic redlink application',
@@ -84,17 +62,13 @@
                        'data-parsoid' => json_encode( array( 'sa' => array( 
'href' => $saHref ) ) ),
                ), $saHref );
 
-               // We don't need a real id, just something reasonable.
-               $uid = UUID::getComparisonUUID( null );
-               $post = PostRevision::fromStorageRow( array(
-                       'rev_id' => $uid,
-                       'tree_rev_id' => $uid,
-                       'tree_rev_descendant_id' => $uid,
-                       'tree_parent_id' => $uid,
+               $post = $this->generateObject( array(
+                       // pretend not to be topic title (they're not parsed, 
so ignored)
+                       'tree_parent_id' => UUID::create()->getBinary(),
+                       // set content with link
                        'rev_content' => $anchor,
-                       'rev_flags' => 'html',
-               ) + self::$postRow );
-               $post->setChildren( array() );
+                       'rev_flags' => 'html'
+               ) );
 
                $batch = $this->getMock( 'LinkBatch' );
                $batch->expects( $this->once() )

-- 
To view, visit https://gerrit.wikimedia.org/r/107563
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I39148bc4b5fdad80bd107c7f461cc0041bc8c2b2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to