Merge "Add a test verifying the reproducibility of domains.php"

This commit is contained in:
jenkins-bot 2020-02-10 17:36:14 +00:00 committed by Gerrit Code Review
commit 728a5b0825

View file

@ -18,6 +18,7 @@
namespace MediaWiki\SecureLinkFixer\Test;
use MediaWiki\SecureLinkFixer\ListFetcher;
use MediaWikiTestCase;
/**
@ -26,6 +27,16 @@ use MediaWikiTestCase;
*/
class DomainsTest extends MediaWikiTestCase {
public function testReproducibility() {
$domains = file_get_contents( __DIR__ . '/../../domains.php' );
preg_match( '/mozilla-central@([0-9a-f]*?) \((.*?)\)/', $domains, $matches );
$this->assertCount( 3, $matches );
[ , $rev, $date ] = $matches;
$lf = new ListFetcher();
$expected = $lf->fetchList( $rev, $date );
$this->assertSame( $expected, $domains );
}
public function testDomains() {
$domains = require __DIR__ . '/../../domains.php';
$this->assertIsArray( $domains );