Skip to content

Commit cd892fe

Browse files
authored
Merge pull request #40 from wpengine/qunit-ci
Run QUnit tests on Travis CI.
2 parents 1bfbf38 + fbf3ae5 commit cd892fe

File tree

4 files changed

+89
-81
lines changed

4 files changed

+89
-81
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ matrix:
1717

1818
before_script:
1919
- composer install
20+
- npm install
2021
- bash tests/bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
2122

22-
script: phpunit
23+
script:
24+
- phpunit
25+
- npm test

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"name": "php-compatibility-checker",
33
"devDependencies": {
4-
"grunt": "^1.0.1",
5-
"grunt-wp-readme-to-markdown": "^2.0.0"
4+
"grunt": "^0.4.5",
5+
"grunt-wp-readme-to-markdown": "^2.0.0",
6+
"node-qunit-phantomjs": "^1.4.0"
7+
},
8+
"scripts": {
9+
"test": "node-qunit-phantomjs tests/qunit/index.html --verbose"
610
}
711
}

tests/qunit/helpers.js

Lines changed: 75 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -16,78 +16,79 @@ var helpers = {
1616
}
1717
return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
1818
},
19-
passResults: `Name: Twenty Fifteen
20-
21-
PHP 5.5 compatible.
22-
23-
Name: Akismet
24-
25-
PHP 5.5 compatible.
26-
Update Available: 3.1.11; Current Version: 3.1.7;
27-
`,
28-
skipResults : `Name: Twenty Fifteen
29-
30-
PHP 5.5 compatible.
31-
32-
Name: Really Big Plugin
33-
34-
The plugin/theme was skipped as it was too large to scan before the server killed the process.
35-
36-
`,
37-
failResults: `Name: wp-bootstrap
38-
39-
PHP 5.5 compatible.
40-
41-
Name: Types - Complete Solution for Custom Fields and Types
42-
43-
FILE: /nas/content/live/plugindb/wp-content/plugins/types/admin.php
44-
-----------------------------------------------------------------------------
45-
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
46-
-----------------------------------------------------------------------------
47-
1 | WARNING | File has mixed line endings; this may cause incorrect results
48-
-----------------------------------------------------------------------------
49-
50-
51-
FILE: /nas/content/live/plugindb/wp-content/plugins/types/embedded/includes/fields/date/functions.php
52-
-----------------------------------------------------------------------------------------------------
53-
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
54-
-----------------------------------------------------------------------------------------------------
55-
1 | WARNING | File has mixed line endings; this may cause incorrect results
56-
-----------------------------------------------------------------------------------------------------
57-
Update Available: 2.1; Current Version: 1.6.4;
58-
59-
Name: Require Login
60-
61-
PHP 5.5 compatible.
62-
63-
Name: PHP Compatibility Checker
64-
65-
PHP 5.5 compatible.
66-
67-
Name: Custom Permalinks
68-
69-
PHP 5.5 compatible.
70-
Update Available: 0.7.25; Current Version: 0.7.19;
71-
72-
Name: CRED Frontend Editor
73-
74-
FILE: /nas/content/live/plugindb/wp-content/plugins/cred-frontend-editor/third-party/zebra_form/includes/XSSClean.php
75-
---------------------------------------------------------------------------------------------------------------------
76-
FOUND 2 ERRORS AFFECTING 2 LINES
77-
---------------------------------------------------------------------------------------------------------------------
78-
300 | ERROR | preg_replace() - /e modifier is deprecated in PHP 5.5
79-
301 | ERROR | preg_replace() - /e modifier is deprecated in PHP 5.5
80-
---------------------------------------------------------------------------------------------------------------------
81-
82-
Name: Crayon Syntax Highlighter
83-
84-
FILE: /nas/content/live/plugindb/wp-content/plugins/crayon-syntax-highlighter/util/crayon_util.class.php
85-
--------------------------------------------------------------------------------------------------------
86-
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
87-
--------------------------------------------------------------------------------------------------------
88-
652 | WARNING | The use of function split is discouraged from PHP version 5.3; use preg_split instead
89-
--------------------------------------------------------------------------------------------------------
90-
Update Available: 2.8.4; Current Version: 2.6.8;
91-
92-
`
19+
passResults: 'Name: Twenty Fifteen' +
20+
'' +
21+
'PHP 5.5 compatible.' +
22+
'' +
23+
'Name: Akismet' +
24+
'' +
25+
'PHP 5.5 compatible.' +
26+
'Update Available: 3.1.11; Current Version: 3.1.7;' +
27+
'' +
28+
'',
29+
skipResults : 'Name: Twenty Fifteen' +
30+
'' +
31+
'PHP 5.5 compatible.' +
32+
'' +
33+
'Name: Really Big Plugin' +
34+
'' +
35+
'The plugin/theme was skipped as it was too large to scan before the server killed the process.' +
36+
'' +
37+
'',
38+
failResults: 'Name: wp-bootstrap' +
39+
'' +
40+
'PHP 5.5 compatible.' +
41+
'' +
42+
'Name: Types - Complete Solution for Custom Fields and Types' +
43+
'' +
44+
'FILE: /nas/content/live/plugindb/wp-content/plugins/types/admin.php' +
45+
'-----------------------------------------------------------------------------' +
46+
'FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE' +
47+
'-----------------------------------------------------------------------------' +
48+
' 1 | WARNING | File has mixed line endings; this may cause incorrect results' +
49+
'-----------------------------------------------------------------------------' +
50+
'' +
51+
'' +
52+
'FILE: /nas/content/live/plugindb/wp-content/plugins/types/embedded/includes/fields/date/functions.php' +
53+
'-----------------------------------------------------------------------------------------------------' +
54+
'FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE' +
55+
'-----------------------------------------------------------------------------------------------------' +
56+
' 1 | WARNING | File has mixed line endings; this may cause incorrect results' +
57+
'-----------------------------------------------------------------------------------------------------' +
58+
'Update Available: 2.1; Current Version: 1.6.4;' +
59+
'' +
60+
'Name: Require Login' +
61+
'' +
62+
'PHP 5.5 compatible.' +
63+
'' +
64+
'Name: PHP Compatibility Checker' +
65+
'' +
66+
'PHP 5.5 compatible.' +
67+
'' +
68+
'Name: Custom Permalinks' +
69+
'' +
70+
'PHP 5.5 compatible.' +
71+
'Update Available: 0.7.25; Current Version: 0.7.19;' +
72+
'' +
73+
'Name: CRED Frontend Editor' +
74+
'' +
75+
'FILE: /nas/content/live/plugindb/wp-content/plugins/cred-frontend-editor/third-party/zebra_form/includes/XSSClean.php' +
76+
'---------------------------------------------------------------------------------------------------------------------' +
77+
'FOUND 2 ERRORS AFFECTING 2 LINES' +
78+
'---------------------------------------------------------------------------------------------------------------------' +
79+
' 300 | ERROR | preg_replace() - /e modifier is deprecated in PHP 5.5' +
80+
' 301 | ERROR | preg_replace() - /e modifier is deprecated in PHP 5.5' +
81+
'---------------------------------------------------------------------------------------------------------------------' +
82+
'' +
83+
'Name: Crayon Syntax Highlighter' +
84+
'' +
85+
'FILE: /nas/content/live/plugindb/wp-content/plugins/crayon-syntax-highlighter/util/crayon_util.class.php' +
86+
'--------------------------------------------------------------------------------------------------------' +
87+
'FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE' +
88+
'--------------------------------------------------------------------------------------------------------' +
89+
' 652 | WARNING | The use of function split is discouraged from PHP version 5.3; use preg_split instead' +
90+
'--------------------------------------------------------------------------------------------------------' +
91+
'Update Available: 2.8.4; Current Version: 2.6.8;' +
92+
'' +
93+
''
9394
};

tests/qunit/test-run.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ QUnit.test( 'Render test pass', function( assert ) {
5858
assert.ok( helpers.passResults === displayedResults, 'Text results are correct' );
5959
assert.ok( $('#footer').is(':visible'), 'Footer is visible' );
6060
assert.ok( $('.wpe-results-card').length == 2, 'There are 2 results.' );
61-
assert.ok( $('#standardMode').text().includes( 'Your WordPress install is PHP 5.5 compatible.' ), 'Test did pass.' );
61+
assert.ok( $('#standardMode').text().indexOf( 'Your WordPress install is PHP 5.5 compatible.' ) !== -1, 'Test did pass.' );
6262
assert.ok( '#038103' === helpers.rgb2hex( $( ".wpe-results-card" ).eq( 0 ).css( 'border-left-color' ) ), 'First plugin marked as passed.' );
63-
assert.ok( ! $( '#standardMode' ).text().includes( '0 out of 2' ), 'No scan stats are shown.' );
63+
assert.ok( $( '#standardMode' ).text().indexOf( '0 out of 2' ) === -1, 'No scan stats are shown.' );
6464
});
6565

6666
QUnit.test( 'Render test fail', function( assert ) {
@@ -77,8 +77,8 @@ QUnit.test( 'Render test fail', function( assert ) {
7777
assert.ok( helpers.failResults === displayedResults, 'Text results are correct' );
7878
assert.ok( $('#footer').is(':visible'), 'Footer is visible' );
7979
assert.ok( $('.wpe-results-card').length == 7, 'There are 7 results.' );
80-
assert.ok( $('#standardMode').text().includes( 'Your WordPress install is not PHP 5.5 compatible.' ), 'Test did not pass.' );
81-
assert.ok( $( '#standardMode' ).text().includes( '1 out of 7' ), 'Scan stats are correct' );
80+
assert.ok( $('#standardMode').text().indexOf( 'Your WordPress install is not PHP 5.5 compatible.' ) !== -1, 'Test did not pass.' );
81+
assert.ok( $( '#standardMode' ).text().indexOf( '1 out of 7' ) !== -1, 'Scan stats are correct' );
8282
});
8383

8484
QUnit.test( 'Render test skip', function( assert ) {

0 commit comments

Comments
 (0)