Merge "Add sanity check to notifyUpdatesForRevision() for $oldRev"
[lhc/web/wiklou.git] / tests / phpunit / documentation / ReleaseNotesTest.php
index 4de071d..2789571 100644 (file)
@@ -30,25 +30,38 @@ class ReleaseNotesTest extends MediaWikiTestCase {
                );
 
                foreach ( $notesFiles as $index => $fileName ) {
-                       $file = file( $fileName, FILE_IGNORE_NEW_LINES );
+                       $this->assertFileLength( "Release Notes", $fileName );
+               }
 
-                       $this->assertFalse(
-                               !$file,
-                               "Release Notes file '$fileName' is inaccessible."
-                       );
+               // Also test the README and similar files
+               $otherFiles = [ "$IP/COPYING", "$IP/FAQ", "$IP/INSTALL", "$IP/README", "$IP/SECURITY" ];
 
-                       $lines = count( $file );
+               foreach ( $otherFiles as $index => $fileName ) {
+                       $this->assertFileLength( "Help", $fileName );
+               }
+       }
 
-                       for ( $i = 0; $i < $lines; $i++ ) {
-                               $line = $file[$i];
+       /**
+        */
+       private function assertFileLength( $type, $fileName ) {
+               $file = file( $fileName, FILE_IGNORE_NEW_LINES );
 
-                               $this->assertLessThanOrEqual(
-                                       // FILE_IGNORE_NEW_LINES drops the \n at the EOL, so max length is 80 not 81.
-                                       80,
-                                       strlen( $line ),
-                                       "Release notes file '$fileName' line $i is longer than 80 chars:\n\t'$line'"
-                               );
-                       }
+               $this->assertFalse(
+                       !$file,
+                       "$type 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 ),
+                               "$type file '$fileName' line $i is longer than 80 chars:\n\t'$line'"
+                       );
                }
        }
 }