2016-12-12 14:26:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @group Database
|
|
|
|
|
*/
|
2017-06-04 01:12:21 +00:00
|
|
|
class ContribsPagerTest extends \PHPUnit_Framework_TestCase {
|
2016-12-12 14:26:15 +00:00
|
|
|
/**
|
|
|
|
|
* @dataProvider dateFilterOptionProcessingProvider
|
|
|
|
|
* @param array $inputOpts Input options
|
|
|
|
|
* @param array $expectedOpts Expected options
|
|
|
|
|
*/
|
|
|
|
|
public function testDateFilterOptionProcessing( $inputOpts, $expectedOpts ) {
|
2017-06-04 01:12:21 +00:00
|
|
|
$this->assertArraySubset( $expectedOpts, ContribsPager::processDateFilter( $inputOpts ) );
|
2016-12-12 14:26:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function dateFilterOptionProcessingProvider() {
|
|
|
|
|
return [
|
|
|
|
|
[ [ 'start' => '2016-05-01',
|
|
|
|
|
'end' => '2016-06-01',
|
|
|
|
|
'year' => null,
|
|
|
|
|
'month' => null ],
|
|
|
|
|
[ 'start' => '2016-05-01',
|
|
|
|
|
'end' => '2016-06-01' ] ],
|
|
|
|
|
[ [ 'start' => '2016-05-01',
|
|
|
|
|
'end' => '2016-06-01',
|
|
|
|
|
'year' => '',
|
|
|
|
|
'month' => '' ],
|
|
|
|
|
[ 'start' => '2016-05-01',
|
|
|
|
|
'end' => '2016-06-01' ] ],
|
|
|
|
|
[ [ 'start' => '2016-05-01',
|
|
|
|
|
'end' => '2016-06-01',
|
|
|
|
|
'year' => '2012',
|
|
|
|
|
'month' => '5' ],
|
|
|
|
|
[ 'start' => '',
|
|
|
|
|
'end' => '2012-05-31' ] ],
|
|
|
|
|
[ [ 'start' => '',
|
|
|
|
|
'end' => '',
|
|
|
|
|
'year' => '2012',
|
|
|
|
|
'month' => '5' ],
|
|
|
|
|
[ 'start' => '',
|
|
|
|
|
'end' => '2012-05-31' ] ],
|
|
|
|
|
[ [ 'start' => '',
|
|
|
|
|
'end' => '',
|
|
|
|
|
'year' => '2012',
|
|
|
|
|
'month' => '' ],
|
|
|
|
|
[ 'start' => '',
|
|
|
|
|
'end' => '2012-12-31' ] ],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|