Skip to content

Commit 5b4b10b

Browse files
committed
Tests: Check readme recommendations without external HTTP requests.
Run the offline check for recommended PHP, MySQL, and MariaDB version declarations in the default suite. Keep `external-http` on the three methods that check versions against external services. Developed in: #14686 Props devmuhib, huzaifaalmesbah. See #63914. git-svn-id: https://develop.svn.wordpress.org/trunk@64732 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 0c8d8da commit 5b4b10b

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

‎tests/phpunit/tests/readme.php‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,35 @@
33
* Validate recommended versions for dependencies referenced in `readme.html`,
44
* based on external site support pages.
55
*
6-
* @group external-http
6+
* @group readme
77
*/
88
class Tests_Readme extends WP_UnitTestCase {
99

10+
/**
11+
* Tests that readme.html contains valid recommended versions for PHP, MySQL, and MariaDB.
12+
*
13+
* @ticket 63914
14+
*
15+
* @coversNothing
16+
*/
17+
public function test_readme_contains_recommended_versions() {
18+
$readme = file_get_contents( ABSPATH . 'readme.html' );
19+
$this->assertIsString( $readme, 'readme.html should exist and be readable.' );
20+
21+
$this->assertSame( 1, preg_match( '#Recommendations.*PHP</a> version <strong>([0-9.]+)#s', $readme, $php_matches ), 'readme.html should declare a recommended PHP version.' );
22+
$this->assertNotEmpty( $php_matches[1], 'Recommended PHP version should not be empty.' );
23+
24+
$this->assertSame( 1, preg_match( '#Recommendations.*MySQL</a> version <strong>([0-9.]+)#s', $readme, $mysql_matches ), 'readme.html should declare a recommended MySQL version.' );
25+
$this->assertNotEmpty( $mysql_matches[1], 'Recommended MySQL version should not be empty.' );
26+
27+
$this->assertSame( 1, preg_match( '#Recommendations.*MariaDB</a> version <strong>([0-9.]+)#s', $readme, $mariadb_matches ), 'readme.html should declare a recommended MariaDB version.' );
28+
$this->assertNotEmpty( $mariadb_matches[1], 'Recommended MariaDB version should not be empty.' );
29+
}
30+
1031
/**
1132
* @coversNothing
33+
*
34+
* @group external-http
1235
*/
1336
public function test_readme_php_version() {
1437
// This test is designed to only run on trunk.
@@ -27,6 +50,8 @@ public function test_readme_php_version() {
2750

2851
/**
2952
* @coversNothing
53+
*
54+
* @group external-http
3055
*/
3156
public function test_readme_mysql_version() {
3257
// This test is designed to only run on trunk.
@@ -63,6 +88,8 @@ public function test_readme_mysql_version() {
6388

6489
/**
6590
* @coversNothing
91+
*
92+
* @group external-http
6693
*/
6794
public function test_readme_mariadb_version() {
6895
// This test is designed to only run on trunk.

0 commit comments

Comments
 (0)