Hygiene: Remove unused method on EchoTargetPageMapper

Change-Id: Ic2517bf095421ced125c653716fbf44c7934a1e9
This commit is contained in:
Erik Bernhardson 2015-03-16 08:48:22 -07:00
parent d503ae5932
commit e9f1e67487
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 (