wiki.techinc.nl/tests/phpunit/includes/specials/SpecialLogTest.php
Kunal Mehta f198154d76 SpecialLog: Don't throw exceptions on invalid date from user input
If users provide invalid input to the date option on Special:Log (most likely
an intentional thing given the calendar input widget), don't let the
TimestampException bubble up - just discard the invalid date.

Integration test included, which fails without this patch.

Bug: T201411
Change-Id: Ie1a9a84343ae4e78e076586f759917e5fd5af33c
2018-09-24 08:56:48 -07:00

35 lines
641 B
PHP

<?php
/**
* @license GPL-2.0-or-later
* @author Legoktm
*/
/**
* @covers SpecialLog
*/
class SpecialLogTest extends SpecialPageTestBase {
/**
* Returns a new instance of the special page under test.
*
* @return SpecialPage
*/
protected function newSpecialPage() {
return new SpecialLog();
}
/**
* Verify that no exception was thrown for an invalid date
* @see T201411
*/
public function testInvalidDate() {
list( $html, ) = $this->executeSpecialPage(
'',
// There is no 13th month
new FauxRequest( [ 'wpdate' => '2018-13-01' ] ),
'qqx'
);
$this->assertContains( '(log-summary)', $html );
}
}