mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
Hygiene: Remove unused method on EchoTargetPageMapper
Change-Id: Ic2517bf095421ced125c653716fbf44c7934a1e9
This commit is contained in:
parent
d503ae5932
commit
e9f1e67487
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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 (
|
||||
|
|
Loading…
Reference in a new issue