16 $pager = $this->getMockForAbstractClass( ReverseChronologicalPager::class );
17 $timestamp = MWTimestamp::getInstance();
20 $currYear = $timestamp->format(
'Y' );
21 $currMonth = $timestamp->format(
'n' );
24 $this->assertEquals( $pager->getDateCond( 2006, 6 ), $pager->mOffset );
27 $pager->getDateCond( 2006, 6 );
28 $this->assertEquals( $pager->mOffset,
$db->
timestamp(
'20060701000000' ) );
31 $pager->getDateCond( 2006, 6, 5 );
32 $this->assertEquals( $pager->mOffset,
$db->
timestamp(
'20060606000000' ) );
35 $pager->getDateCond( 2006, 12 );
36 $this->assertEquals( $pager->mOffset,
$db->
timestamp(
'20070101000000' ) );
39 $pager->getDateCond( 2006, 6, 30 );
40 $this->assertEquals( $pager->mOffset,
$db->
timestamp(
'20060701000000' ) );
43 $pager->getDateCond( 2006, -1 );
44 $this->assertEquals( $pager->mOffset,
$db->
timestamp(
'20070101000000' ) );
47 $pager->getDateCond( 2006, 6, 1337 );
48 $this->assertEquals( $pager->mOffset,
$db->
timestamp(
'20060701000000' ) );
51 $pager->getDateCond( 2006, 12, 31 );
52 $this->assertEquals( $pager->mOffset,
$db->
timestamp(
'20070101000000' ) );
55 $pager->getDateCond( 2006, 12, 32 );
56 $this->assertEquals( $pager->mOffset,
$db->
timestamp(
'20070101000000' ) );
59 if ( $currMonth < 5 ) {
60 $pager->getDateCond( -1, 5 );
61 $this->assertEquals( $pager->mOffset,
$db->
timestamp( $currYear - 1 .
'0601000000' ) );
63 if ( $currMonth < 12 ) {
64 $pager->getDateCond( -1, 12 );
65 $this->assertEquals( $pager->mOffset,
$db->
timestamp( $currYear .
'0101000000' ) );