wiki.techinc.nl/tests/phpunit/documentation/ReleaseNotesTest.php
Timo Tijhof 506c2f4d57 RELEASE-NOTES: Use New/Changed/Removed pattern for Configuration section
This was already used for external libraries. This commit
changes the order to be consistently 'New/Changed/Removed',
and adopts the pattern for configuration changes as well.

For improved scannability, the bullet points now start with
the name of the configuration setting(s), followed by a sentence,
with an optional ticket in brackets after the sentence(s).

* A number of bullet points under "Configuration changes" were
  in fact, not configuration changes. These have been moved to
  "New features" or "Other changes" for now.

* Add mention of the relevant configuration variable to some
  of the release notes: $wgTidyDriver, `watchlistdays`,
  $wgGroupPermissions, $wgGroupPermissions.

Also fix ReleaseNotesTest to count characters, not bytes,
this was causing it to count – as two, and € as three.

Change-Id: Ie89dac6408f8a8dafbf59efe73a11f4d282c0c6b
2018-09-01 19:59:30 +00:00

54 lines
1.3 KiB
PHP

<?php
/**
* James doesn't like having to manually fix these things.
*/
class ReleaseNotesTest extends MediaWikiTestCase {
/**
* Verify that at least one Release Notes file exists, have content, and
* aren't overly long.
*
* @group documentation
* @coversNothing
*/
public function testReleaseNotesFilesExistAndAreNotMalformed() {
global $wgVersion, $IP;
$notesFiles = glob( "$IP/RELEASE-NOTES-*" );
$this->assertGreaterThanOrEqual(
1,
count( $notesFiles ),
'Repo has at least one Release Notes file.'
);
$versionParts = explode( '.', explode( '-', $wgVersion )[0] );
$this->assertContains(
"$IP/RELEASE-NOTES-$versionParts[0].$versionParts[1]",
$notesFiles,
'Repo has a Release Notes file for the current $wgVersion.'
);
foreach ( $notesFiles as $index => $fileName ) {
$file = file( $fileName, FILE_IGNORE_NEW_LINES );
$this->assertFalse(
!$file,
"Release Notes file '$fileName' is inaccessible."
);
$lines = count( $file );
for ( $i = 0; $i < $lines; $i++ ) {
$line = $file[$i];
$this->assertLessThanOrEqual(
// FILE_IGNORE_NEW_LINES drops the \n at the EOL, so max length is 80 not 81.
80,
mb_strlen( $line ),
"Release notes file '$fileName' line $i is longer than 80 chars:\n\t'$line'"
);
}
}
}
}