Merge "Hygiene: Remove unused method on EchoTargetPageMapper"

This commit is contained in:
jenkins-bot 2015-03-20 12:26:23 +00:00 committed by Gerrit Code Review
commit 7be4aad14c
2 changed files with 0 additions and 59 deletions

View file

@ -45,39 +45,6 @@ class EchoTargetPageMapper extends EchoAbstractMapper {
}
}
/**
* Fetch EchoTargetPage records by user and set of event_id
*
* @param User $user
* @param int[] $eventIds
* @return EchoTargetPage[]|boolean
*/
public function fetchByUserEventIds( User $user, array $eventIds ) {
if ( !$eventIds ) {
return array();
}
$dbr = $this->dbFactory->getEchoDb( DB_SLAVE );
$res = $dbr->select(
array( 'echo_target_page' ),
self::$fields,
array(
'etp_user' => $user->getId(),
'etp_event' => $eventIds
),
__METHOD__
);
if ( $res ) {
$targetPages = array();
foreach ( $res as $row ) {
$targetPages[] = EchoTargetPage::newFromRow( $row );
}
return $targetPages;
} else {
return false;
}
}
/**
* Insert an EchoTargetPage instance into the database
*

View file

@ -28,32 +28,6 @@ class EchoTargetPageMapperTest extends MediaWikiTestCase {
}
}
public function testFetchByUserEventIds() {
$targetMapper = new EchoTargetPageMapper( $this->mockMWEchoDbFactory( array ( 'select' => false ) ) );
$res = $targetMapper->fetchByUserEventIds( User::newFromId( 1 ), array( 1, 2, 3 ) );
$this->assertFalse( $res );
$dbResult = array (
(object)array (
'etp_user' => 1,
'etp_page' => 2,
'etp_event' => 2
),
(object)array (
'etp_user' => 1,
'etp_page' => 2,
'etp_event' => 3,
)
);
$targetMapper = new EchoTargetPageMapper( $this->mockMWEchoDbFactory( array ( 'select' => $dbResult ) ) );
$res = $targetMapper->fetchByUserEventIds( User::newFromId( 1 ), array( 1, 2, 3 ) );
$this->assertTrue( is_array( $res ) );
$this->assertCount( 2, $res );
foreach ( $res as $row ) {
$this->assertInstanceOf( 'EchoTargetPage', $row );
}
}
public function provideDataTestInsert() {
return array (
array (