Skip to content

Commit 410959c

Browse files
Build/Test Tools: Fix the Travis CI build for the 3.8 branch.
Among other fixes, this backports [26871], [26909-26910], [26940], [27086], [27168], [28799], [28873], [28943], [28961], [28964], [28966-28967], [29120], [29251], [29503], [29860], [29869], [29954], [30001], [30160], [30282], [30285], [30289-30291], [30513-30514], [30516-30521], [30524], [30526], [30529-30530], [31253-31254], [31257-31259], [31622], [40241], [40255], [40257], [40259], [40269], [40271], [40446], [40449], [40457], [40604], [40538], [40833], [41082], [41303], [41306], [44993]. See #49485. git-svn-id: https://develop.svn.wordpress.org/branches/3.8@47338 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 03cccce commit 410959c

64 files changed

Lines changed: 983 additions & 1954 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 84 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,95 @@
1+
# Travis CI Configuration File
2+
sudo: false
3+
dist: trusty
14
language: php
5+
cache:
6+
directories:
7+
- $HOME/.npm
8+
- vendor
9+
- $HOME/.composer/cache
210

3-
php:
4-
- "5.5"
5-
- "5.2"
11+
# Build matrix options
12+
matrix:
13+
include:
14+
- php: 5.5
15+
env: WP_TRAVISCI=travis:js
16+
- php: 5.5
17+
env: WP_TRAVISCI=travis:phpunit
18+
- php: 5.2
19+
env: WP_TRAVISCI=travis:phpunit
20+
dist: precise
21+
fast_finish: true
622

7-
before_script:
8-
- |
9-
stable='^[0-9\.]+$';
10-
if [[ "$TRAVIS_PHP_VERSION" =~ $stable ]]; then
11-
phpenv config-rm xdebug.ini
12-
fi
13-
- mysql -e "CREATE DATABASE wordpress_tests;" -uroot
14-
- cp wp-tests-config-sample.php wp-tests-config.php
15-
- sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
16-
- sed -i "s/yourusernamehere/travis/" wp-tests-config.php
17-
- sed -i "s/yourpasswordhere//" wp-tests-config.php
18-
- svn checkout https://plugins.svn.wordpress.org/wordpress-importer/trunk tests/phpunit/data/plugins/wordpress-importer
19-
- npm install -g grunt-cli
20-
- npm install
21-
- php --version
23+
# Before install, failures in this section will result in build status 'errored'
24+
before_install:
25+
- WP_CORE_DIR=/tmp/wordpress/
26+
- >
27+
if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
28+
mysql -e "CREATE DATABASE wordpress_tests;" -uroot
29+
cp wp-tests-config-sample.php wp-tests-config.php
30+
sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
31+
sed -i "s/yourusernamehere/travis/" wp-tests-config.php
32+
sed -i "s/yourpasswordhere//" wp-tests-config.php
33+
svn checkout https://plugins.svn.wordpress.org/wordpress-importer/trunk tests/phpunit/data/plugins/wordpress-importer
34+
fi
2235
23-
script: grunt test
36+
# Before script, failures in this section will result in build status 'failed'
37+
before_script:
38+
- |
39+
# Remove Xdebug for a huge performance increase, but not from nightly:
40+
stable='^[0-9\.]+$'
41+
if [[ "$TRAVIS_PHP_VERSION" =~ $stable ]]; then
42+
phpenv config-rm xdebug.ini
43+
fi
44+
- |
45+
# Export Composer's global bin dir to PATH, but not on PHP 5.2:
46+
if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.2" ]]; then
47+
composer config --list --global
48+
export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }`
49+
fi
50+
- |
51+
# Install the specified version of PHPUnit depending on the PHP version:
52+
if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
53+
case "$TRAVIS_PHP_VERSION" in
54+
7.1|7.0|nightly)
55+
echo "Using PHPUnit 5.x"
56+
composer global require "phpunit/phpunit:^5"
57+
;;
58+
5.6|5.5|5.4|5.3)
59+
echo "Using PHPUnit 4.x"
60+
composer global require "phpunit/phpunit:^4"
61+
;;
62+
5.2)
63+
# Do nothing, use default PHPUnit 3.6.x
64+
echo "Using default PHPUnit, hopefully 3.6"
65+
;;
66+
*)
67+
echo "No PHPUnit version handling for PHP version $TRAVIS_PHP_VERSION"
68+
exit 1
69+
;;
70+
esac
71+
fi
72+
- npm --version
73+
- node --version
74+
- nvm install 0.10.48
75+
- npm install -g grunt-cli
76+
- npm install
77+
- npm prune
78+
- php --version
79+
- php -m
80+
- npm --version
81+
- node --version
82+
- which phpunit
83+
- phpunit --version
84+
- curl --version
85+
- grunt --version
86+
- git --version
87+
- svn --version
88+
script: grunt $WP_TRAVISCI
2489
notifications:
2590
slack:
2691
rooms:
2792
secure: PO3x/bhYXNFqAMtzDzpOAnHcg2KzG2gGbBDft1HlqN4O8hRJqrRs7hqsEe9wKZUs6qf9Jv0ZleJ5AmcSd0DbDAFsfqeWtnWpsj8NqOIWgLX0C2idvfNRzCX1mUd6E1hlAjjTGnKn4MV3m1dRurwcDqacSBVtbXKQ+yPSgM3eXYkDz8EFbTsMcda8pFskcXr98E7/YomU0QtgOcjXndxGZ53zUQ1rfaDwUJzGY3bn5nLoweVZsSIeEFSiNcip7Kt22zVlU0SAb6QlBf3F0h9IWoRD59BQ7pkl53FWzpXoHzUYOFmn0jB5y1vHMlHvTDVEmDuumpCEqnxVvLh33AwGtqYRWH36PEfTn/u1YTFr7FS7KbwrKw9Nn+jUZe3KFrVzgQNUt0El33mO0FbSoNEWJhxRarp0D1z3/HVsbon3Fwzt/3jBHGf9nI+tHH4u7KQ70+M7pzBsV7F7Lc60YnuKrcy/hkwObGB0Za9tMHPUw3c7b4ep6nSa4ts9S++IijLWDaNAq7K/j7fAfI1JrkPIw4T6PcGpNAADkmlCrvToKE4axExaJke/lkUb+3Pwdj0h7ePzPSrHT8aASlKFM1PuI1KRMn/J4wRLtGeLlfYXvVlaQYmJobJtYgoiNWJWMIybLGVBSVPohdGO3qIJbl8WNPN1cW2ZZTcEBprLe8y7MSo=
2893
on_start: never
2994
on_failure: always
3095
on_success: change
31-
on_pull_requests: false

Gruntfile.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,18 @@ module.exports = function(grunt) {
359359

360360
// Register tasks.
361361

362-
// Copy task.
363-
grunt.registerTask('copy:all', ['copy:files', 'copy:version']);
364-
365362
// RTL task.
366363
grunt.registerTask('rtl', ['cssjanus:core', 'cssjanus:colors']);
367364

368365
// Color schemes task.
369366
grunt.registerTask('colors', ['sass:colors']);
370367

368+
// JSHint task.
369+
grunt.registerTask('jshint:corejs', ['jshint:grunt', 'jshint:tests', 'jshint:themes', 'jshint:core']);
370+
371+
// Copy task.
372+
grunt.registerTask('copy:all', ['copy:files', 'copy:version']);
373+
371374
// Build task.
372375
grunt.registerTask('build', ['clean:all', 'copy:all', 'cssmin:core', 'colors', 'rtl', 'cssmin:rtl', 'cssmin:colors',
373376
'uglify:core', 'uglify:tinymce', 'concat:tinymce', 'compress:tinymce', 'clean:tinymce']);
@@ -383,8 +386,13 @@ module.exports = function(grunt) {
383386

384387
grunt.registerTask('qunit:compiled', 'Runs QUnit tests on compiled as well as uncompiled scripts.',
385388
['build', 'copy:qunit', 'qunit']);
389+
386390
grunt.registerTask('test', 'Runs all QUnit and PHPUnit tasks.', ['qunit:compiled', 'phpunit']);
387391

392+
// Travis CI tasks.
393+
grunt.registerTask('travis:js', 'Runs Javascript Travis CI tasks.', [ 'jshint:corejs', 'qunit:compiled' ]);
394+
grunt.registerTask('travis:phpunit', 'Runs PHPUnit Travis CI tasks.', 'phpunit');
395+
388396
// Default task.
389397
grunt.registerTask('default', ['build']);
390398

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
"devDependencies": {
1212
"grunt": "~0.4.1",
1313
"grunt-contrib-clean": "~0.5.0",
14+
"grunt-contrib-compress": "~0.5.2",
15+
"grunt-contrib-concat": "~0.3.0",
1416
"grunt-contrib-copy": "~0.4.1",
1517
"grunt-contrib-cssmin": "~0.6.1",
18+
"grunt-contrib-jshint": "~0.10.0",
1619
"grunt-contrib-qunit": "~0.2.2",
1720
"grunt-contrib-uglify": "~0.2.2",
1821
"grunt-contrib-watch": "~0.5.1",
19-
"grunt-contrib-compress": "~0.5.2",
20-
"grunt-contrib-concat": "~0.3.0",
21-
"grunt-contrib-jshint": "~0.7.0",
2222
"grunt-cssjanus": "git://github.com/yoavf/grunt-cssjanus.git#e0158f4087d1c4bb5a8d1648a63ef133338b5879",
23-
"grunt-sass": "~1.0.0",
23+
"grunt-sass": "~0.16.0",
2424
"matchdep": "~0.1.2"
2525
}
2626
}

phpunit.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,7 @@
2525
<logging>
2626
<log type="junit" target="tests/phpunit/build/logs/junit.xml" logIncompleteSkipped="false"/>
2727
</logging>
28+
<php>
29+
<const name="WP_RUN_CORE_TESTS" value="1" />
30+
</php>
2831
</phpunit>

tests/phpunit/data/themedir1/broken-theme/.nodelete

Whitespace-only changes.

tests/phpunit/includes/bootstrap.php

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ function wp_tests_options( $value ) {
9595
/**
9696
* A child class of the PHP test runner.
9797
*
98-
* Not actually used as a runner. Rather, used to access the protected
99-
* longOptions property, to parse the arguments passed to the script.
98+
* Used to access the protected longOptions property, to parse the arguments
99+
* passed to the script.
100100
*
101101
* If it is determined that phpunit was called with a --group that corresponds
102102
* to an @ticket annotation (such as `phpunit --group 12345` for bugs marked
@@ -105,31 +105,47 @@ function wp_tests_options( $value ) {
105105
* If WP_TESTS_FORCE_KNOWN_BUGS is already set in wp-tests-config.php, then
106106
* how you call phpunit has no effect.
107107
*/
108-
class WP_PHPUnit_TextUI_Command extends PHPUnit_TextUI_Command {
108+
class WP_PHPUnit_Util_Getopt extends PHPUnit_Util_Getopt {
109+
protected $longOptions = array(
110+
'exclude-group=',
111+
'group=',
112+
);
109113
function __construct( $argv ) {
110-
$options = PHPUnit_Util_Getopt::getopt(
111-
$argv,
112-
'd:c:hv',
113-
array_keys( $this->longOptions )
114-
);
114+
array_shift( $argv );
115+
$options = array();
116+
while ( list( $i, $arg ) = each( $argv ) ) {
117+
try {
118+
if ( strlen( $arg ) > 1 && $arg[0] === '-' && $arg[1] === '-' ) {
119+
PHPUnit_Util_Getopt::parseLongOption( substr( $arg, 2 ), $this->longOptions, $options, $argv );
120+
}
121+
}
122+
catch ( PHPUnit_Framework_Exception $e ) {
123+
// Enforcing recognized arguments or correctly formed arguments is
124+
// not really the concern here.
125+
continue;
126+
}
127+
}
128+
115129
$ajax_message = true;
116-
foreach ( $options[0] as $option ) {
130+
foreach ( $options as $option ) {
117131
switch ( $option[0] ) {
118132
case '--exclude-group' :
119133
$ajax_message = false;
120134
continue 2;
121135
case '--group' :
122136
$groups = explode( ',', $option[1] );
123137
foreach ( $groups as $group ) {
124-
if ( is_numeric( $group ) || preg_match( '/^(UT|Plugin)\d+$/', $group ) )
138+
if ( is_numeric( $group ) || preg_match( '/^(UT|Plugin)\d+$/', $group ) ) {
125139
WP_UnitTestCase::forceTicket( $group );
140+
}
126141
}
127142
$ajax_message = ! in_array( 'ajax', $groups );
128143
continue 2;
129144
}
130145
}
131-
if ( $ajax_message )
146+
if ( $ajax_message ) {
132147
echo "Not running ajax tests... To execute these, use --group ajax." . PHP_EOL;
148+
}
133149
}
134150
}
135-
new WP_PHPUnit_TextUI_Command( $_SERVER['argv'] );
151+
new WP_PHPUnit_Util_Getopt( $_SERVER['argv'] );

0 commit comments

Comments
 (0)