jenkins-bot has submitted this change and it was merged.

Change subject: Merge two PagerTest together
......................................................................


Merge two PagerTest together

Change-Id: I516c756fc2f672a02c00db3e3d27ea4795007830
---
M autoload.php
M tests/phpunit/Data/Pager/PagerTest.php
D tests/phpunit/PagerTest.php
3 files changed, 93 insertions(+), 106 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/autoload.php b/autoload.php
index 1081dce..9217e63 100644
--- a/autoload.php
+++ b/autoload.php
@@ -356,7 +356,6 @@
        'Flow\\Tests\\Model\\UUIDTest' => __DIR__ . 
'/tests/phpunit/Model/UUIDTest.php',
        'Flow\\Tests\\Model\\UserTupleTest' => __DIR__ . 
'/tests/phpunit/Model/UserTupleTest.php',
        'Flow\\Tests\\NotifiedUsersTest' => __DIR__ . 
'/tests/phpunit/Notifications/NotifiedUsersTest.php',
-       'Flow\\Tests\\PagerTest' => __DIR__ . '/tests/phpunit/PagerTest.php',
        'Flow\\Tests\\Parsoid\\BadImageRemoverTest' => __DIR__ . 
'/tests/phpunit/Parsoid/Fixer/BadImageRemoverTest.php',
        'Flow\\Tests\\Parsoid\\BaseHrefFixerTest' => __DIR__ . 
'/tests/phpunit/Parsoid/Fixer/BaseHrefFixerTest.php',
        'Flow\\Tests\\Parsoid\\Fixer\\MethodReturnsConstraint' => __DIR__ . 
'/tests/phpunit/Parsoid/Fixer/WikiLinkFixerTest.php',
diff --git a/tests/phpunit/Data/Pager/PagerTest.php 
b/tests/phpunit/Data/Pager/PagerTest.php
index b24f436..f5512e3 100644
--- a/tests/phpunit/Data/Pager/PagerTest.php
+++ b/tests/phpunit/Data/Pager/PagerTest.php
@@ -7,6 +7,8 @@
 use Flow\Data\BufferedCache;
 use Flow\Data\Index\TopKIndex;
 use Flow\Data\Pager\Pager;
+use Flow\Data\Pager\PagerPage;
+use Flow\Model\UUID;
 use stdClass;
 
 /**
@@ -518,4 +520,95 @@
 
                return $om;
        }
+
+       public function provideDataMakePagingLink() {
+               return array (
+                       array(
+                               $this->mockStorage(
+                                       array(
+                                               $this->mockTopicListEntry(),
+                                               $this->mockTopicListEntry(),
+                                               $this->mockTopicListEntry()
+                                       ),
+                                       UUID::create(),
+                                       array( 'topic_id' )
+                               ),
+                               array( 'topic_list_id' => '123456' ),
+                               array( 'pager-limit' => 2, 'order' => 'desc', 
'sort' => 'topic_id' ),
+                               'offset-id'
+                       ),
+                       array(
+                               $this->mockStorage(
+                                       array(
+                                               $this->mockTopicListEntry(),
+                                               $this->mockTopicListEntry()
+                                       ),
+                                       UUID::create(),
+                                       array( 'workflow_last_update_timestamp' 
)
+                               ),
+                               array( 'topic_list_id' => '123456' ),
+                               array( 'pager-limit' => 1, 'order' => 'desc', 
'sort' => 'workflow_last_update_timestamp', 'sortby' => 'updated' ),
+                               'offset'
+                       )
+               );
+       }
+
+       /**
+        * @dataProvider provideDataMakePagingLink
+        */
+       public function testMakePagingLink( $storage, $query, $options, 
$offsetKey ) {
+               $pager = new Pager( $storage, $query, $options );
+               $page = $pager->getPage();
+               $pagingOption = $page->getPagingLinksOptions();
+               foreach ( $pagingOption as $option ) {
+                       $this->assertArrayHasKey( $offsetKey, $option );
+                       $this->assertArrayHasKey( 'offset-dir', $option );
+                       $this->assertArrayHasKey( 'limit', $option );
+                       if ( isset( $options['sortby'] ) ) {
+                               $this->assertArrayHasKey( 'sortby', $option );
+                       }
+               }
+       }
+
+       /**
+        * Mock the storage
+        */
+       protected function mockStorage( $return, $offset, $sort ) {
+               $storage = $this->getMockBuilder( 'Flow\Data\ObjectManager' )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               $storage->expects( $this->any() )
+                       ->method( 'find' )
+                       ->will( $this->returnValue( $return ) );
+               $storage->expects( $this->any() )
+                       ->method( 'serializeOffset' )
+                       ->will( $this->returnValue( $offset ) );
+               $storage->expects( $this->any() )
+                       ->method( 'getIndexFor' )
+                       ->will( $this->returnValue( $this->mockIndex( $sort ) ) 
);
+               return $storage;
+       }
+
+       /**
+        * Mock TopicListEntry
+        */
+       protected function mockTopicListEntry() {
+               $entry = $this->getMockBuilder( 'Flow\Model\TopicListEntry' )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               return $entry;
+       }
+
+       /**
+        * Mock TopKIndex
+        */
+       protected function mockIndex( $sort ) {
+               $index = $this->getMockBuilder( 'Flow\Data\Index\TopKIndex' )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               $index->expects( $this->any() )
+                       ->method( 'getSort' )
+                       ->will( $this->returnValue( $sort ) );
+               return $index;
+       }
 }
diff --git a/tests/phpunit/PagerTest.php b/tests/phpunit/PagerTest.php
deleted file mode 100644
index b4a4629..0000000
--- a/tests/phpunit/PagerTest.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-
-namespace Flow\Tests;
-
-use Flow\Data\Pager\PagerPage;
-use Flow\Data\Pager\Pager;
-use Flow\Model\UUID;
-
-/**
- * @group Flow
- */
-class PagerTest extends FlowTestCase {
-
-       public function provideDataMakePagingLink() {
-               return array (
-                       array(
-                               $this->mockStorage(
-                                       array(
-                                               $this->mockTopicListEntry(),
-                                               $this->mockTopicListEntry(),
-                                               $this->mockTopicListEntry()
-                                       ),
-                                       UUID::create(),
-                                       array( 'topic_id' )
-                               ),
-                               array( 'topic_list_id' => '123456' ),
-                               array( 'pager-limit' => 2, 'order' => 'desc', 
'sort' => 'topic_id' ),
-                               'offset-id'
-                       ),
-                       array(
-                               $this->mockStorage(
-                                       array(
-                                               $this->mockTopicListEntry(),
-                                               $this->mockTopicListEntry()
-                                       ),
-                                       UUID::create(),
-                                       array( 'workflow_last_update_timestamp' 
)
-                               ),
-                               array( 'topic_list_id' => '123456' ),
-                               array( 'pager-limit' => 1, 'order' => 'desc', 
'sort' => 'workflow_last_update_timestamp', 'sortby' => 'updated' ),
-                               'offset'
-                       )
-               );
-       }
-
-       /**
-        * @dataProvider provideDataMakePagingLink
-        */
-       public function testMakePagingLink( $storage, $query, $options, 
$offsetKey ) {
-               $pager = new Pager( $storage, $query, $options );
-               $page = $pager->getPage();
-               $pagingOption = $page->getPagingLinksOptions();
-               foreach ( $pagingOption as $option ) {
-                       $this->assertArrayHasKey( $offsetKey, $option );
-                       $this->assertArrayHasKey( 'offset-dir', $option );
-                       $this->assertArrayHasKey( 'limit', $option );
-                       if ( isset( $options['sortby'] ) ) {
-                               $this->assertArrayHasKey( 'sortby', $option );
-                       }
-               }
-       }
-
-       /**
-        * Mock the storage
-        */
-       protected function mockStorage( $return, $offset, $sort ) {
-               $storage = $this->getMockBuilder( 'Flow\Data\ObjectManager' )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-               $storage->expects( $this->any() )
-                       ->method( 'find' )
-                       ->will( $this->returnValue( $return ) );
-               $storage->expects( $this->any() )
-                       ->method( 'serializeOffset' )
-                       ->will( $this->returnValue( $offset ) );
-               $storage->expects( $this->any() )
-                       ->method( 'getIndexFor' )
-                       ->will( $this->returnValue( $this->mockIndex( $sort ) ) 
);
-               return $storage;
-       }
-
-       /**
-        * Mock TopicListEntry
-        */
-       protected function mockTopicListEntry() {
-               $entry = $this->getMockBuilder( 'Flow\Model\TopicListEntry' )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-               return $entry;
-       }
-
-       /**
-        * Mock TopKIndex
-        */
-       protected function mockIndex( $sort ) {
-               $index = $this->getMockBuilder( 'Flow\Data\Index\TopKIndex' )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-               $index->expects( $this->any() )
-                       ->method( 'getSort' )
-                       ->will( $this->returnValue( $sort ) );
-               return $index;
-       }
-
-}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I516c756fc2f672a02c00db3e3d27ea4795007830
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to