Skip to content

Commit bb69088

Browse files
authored
Merge branch 'develop' into add-readme
2 parents 4cbf614 + e632e2d commit bb69088

16 files changed

+589
-239
lines changed

.dev-lib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
DEFAULT_BASE_BRANCH=develop
2-
PHPCS_IGNORE='vendor/*,wp-includes/rest-api/auth/jwt/*,tests/wp-tests/*'
2+
PHPCS_IGNORE='vendor/*,wp-includes/php-jwt/*,tests/wp-tests/*'
33
CHECK_SCOPE=patches

.phpcs.ruleset.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<!-- Ignoring Files and Folders:
1111
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-files-and-folders -->
1212
<exclude-pattern>/vendor/*</exclude-pattern>
13-
<exclude-pattern>/wp-includes/rest-api/auth/jwt/*</exclude-pattern>
13+
<exclude-pattern>/wp-includes/php-jwt/*</exclude-pattern>
1414
<exclude-pattern>/tests/wp-tests/*</exclude-pattern>
1515

1616
<!-- How to scan -->

.travis.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
# Tell Travis CI we're using PHP
21
language: php
32

4-
# Opt to use Travis container-based environment.
53
sudo: false
64

7-
# Newer versions like trusty don't have PHP 5.2 or 5.3
8-
# https://blog.travis-ci.com/2017-07-11-trusty-as-default-linux-is-coming
9-
dist: precise
10-
115
notifications:
126
email:
137
on_success: never
@@ -19,6 +13,11 @@ cache:
1913
- vendor
2014
- $HOME/phpunit-bin
2115

16+
addons:
17+
apt:
18+
packages:
19+
- libxml2-utils
20+
2221
php:
2322
- 7.2
2423

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"license": "GPLv2",
77
"prefer-stable" : true,
88
"require": {
9-
"php": ">=5.3"
9+
"php": ">=5.6.20"
1010
},
1111
"require-dev": {
1212
"brainmaestro/composer-git-hooks": "^2.6.0",
@@ -16,7 +16,7 @@
1616
"php-coveralls/php-coveralls": "^2.1",
1717
"slowprog/composer-copy-file": "0.2.1",
1818
"wp-coding-standards/wpcs": "*",
19-
"xwp/wp-dev-lib": "^1.0.0"
19+
"xwp/wp-dev-lib": "^1.1.1"
2020
},
2121
"scripts": {
2222
"phpcs": [
@@ -48,7 +48,7 @@
4848
"extra": {
4949
"copy-file": {
5050
"tests/autoload.php": "tests/wp-tests/phpunit/wp-tests-config.php",
51-
"vendor/firebase/php-jwt/src/": "wp-includes/rest-api/auth/jwt/"
51+
"vendor/firebase/php-jwt/src/": "wp-includes/php-jwt/"
5252
},
5353
"hooks": {
5454
"pre-commit": "./vendor/xwp/wp-dev-lib/scripts/pre-commit"

jwt-auth.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
* Plugin URI: https://github.com/WP-API/jwt-auth
1212
* Description: Feature plugin to bring JSON Web Token REST API authentication to Core
1313
* Version: 0.1
14-
* Author: XWP, and contributors
14+
* Author: WP-API
1515
* Author URI: https://github.com/WP-API/jwt-auth/graphs/contributors
1616
* Text Domain: jwt-auth
1717
* License: GPL-2.0+
1818
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
1919
* GitHub Plugin URI: https://github.com/WP-API/jwt-auth
20-
* Requires PHP: 5.3.0
20+
* Requires PHP: 5.6.20
2121
* Requires WP: 4.4.0
2222
*/
2323

@@ -26,16 +26,15 @@
2626
define( 'JWT_AUTH_VERSION', '0.1' );
2727

2828
/**
29-
* Requires running PHP 5.3 or above.
29+
* Requires running PHP 5.6.20 or above.
3030
*
3131
* @since 0.1
3232
* @codeCoverageIgnore
3333
*/
3434
function jwt_auth_version_check() {
35-
36-
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
35+
if ( version_compare( PHP_VERSION, '5.6.20', '<' ) ) {
3736
deactivate_plugins( plugin_basename( __FILE__ ) );
38-
wp_die( esc_html__( 'The JWT Auth plugin requires PHP Version 5.3 or above.', 'jwt-auth' ) );
37+
wp_die( esc_html__( 'The JWT Auth plugin requires PHP Version 5.6.20 or above.', 'jwt-auth' ) );
3938
}
4039
}
4140
add_action( 'admin_init', 'jwt_auth_version_check' );
@@ -47,18 +46,18 @@ function jwt_auth_version_check() {
4746
*/
4847
function jwt_auth_loader() {
4948

50-
/** JWT Classes */
51-
foreach ( glob( JWT_AUTH_PLUGIN_DIR . '/wp-includes/rest-api/auth/jwt/*.php' ) as $filename ) {
49+
// JWT Classes.
50+
foreach ( glob( JWT_AUTH_PLUGIN_DIR . '/wp-includes/php-jwt/*.php' ) as $filename ) {
5251
require_once $filename;
5352
}
5453

55-
/** WP_REST_Token Class */
54+
// WP_REST_Token Class.
5655
require_once JWT_AUTH_PLUGIN_DIR . '/wp-includes/rest-api/auth/class-wp-rest-token.php';
5756

58-
/** WP_REST_Key_Pair Class */
57+
// WP_REST_Key_Pair Class.
5958
require_once JWT_AUTH_PLUGIN_DIR . '/wp-includes/rest-api/auth/class-wp-rest-key-pair.php';
6059

61-
/** WP_Key_Pair_List_Table Class */
60+
// WP_Key_Pair_List_Table Class.
6261
require_once JWT_AUTH_PLUGIN_DIR . '/wp-admin/includes/class-wp-key-pair-list-table.php';
6362

6463
// Initialize JSON Web Tokens.

phpunit.xml.dist

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,20 @@
66
convertNoticesToExceptions="true"
77
convertWarningsToExceptions="true"
88
>
9-
<php>
10-
<const name="WP_TEST_VIP_QUICKSTART_ACTIVATED_PLUGINS" value="jetpack/jetpack.php,media-explorer/media-explorer.php,writing-helper/writing-helper.php,mrss/mrss.php,wordpress-importer/wordpress-importer.php,keyring/keyring.php,polldaddy/polldaddy.php" />
11-
<const name="WPCOM_VIP_DISABLE_REMOTE_REQUEST_ERROR_REPORTING" value="1" />
12-
<const name="WP_TEST_ACTIVATED_PLUGINS" value="" /> <!-- this list is used if not on VIP Quickstart -->
13-
</php>
149
<testsuites>
1510
<testsuite>
1611
<directory prefix="class-test-" suffix=".php">./tests/</directory>
1712
<directory prefix="test-" suffix=".php">./tests/</directory>
1813
</testsuite>
1914
</testsuites>
20-
2115
<filter>
2216
<whitelist processUncoveredFilesFromWhitelist="false">
2317
<directory suffix=".php">./</directory>
2418
<exclude>
2519
<directory suffix=".php">./coverage</directory>
2620
<directory suffix=".php">./tests</directory>
2721
<directory suffix=".php">./vendor</directory>
28-
<directory suffix=".php">./wp-includes/rest-api/auth/jwt</directory>
22+
<directory suffix=".php">./wp-includes/php-jwt</directory>
2923
</exclude>
3024
</whitelist>
3125
</filter>

tests/autoload.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,19 @@
88
$config = getenv( 'WP_TESTS_CONFIG' );
99

1010
/**
11-
* Supports loading the wp-tests-config.php from a non VVV custom directory.
11+
* Supports loading the `wp-tests-config.php` from a custom directory.
1212
*/
1313
if ( file_exists( $config ) ) {
1414
include_once $config;
1515
return;
1616
}
1717

18-
// VVV Paths.
18+
// Attempt to find the server Path.
1919
$_path = dirname( __FILE__ );
2020
$config = substr( $_path, 0, strpos( $_path, 'public_html' ) + 11 ) . '/wp-tests-config.php';
2121

2222
/**
23-
* Supports loading the wp-tests-config.php from the `public_html` root directory of both the
24-
* `wordpress-default` and `wordpress-develop` sites, and any other custom site in the www directory.
23+
* Loads the `wp-tests-config.php` from the `public_html` root directory of a typical Vagrant install.
2524
*/
2625
if ( file_exists( $config ) ) {
2726
include_once $config;

tests/wp-includes/rest-api/auth/class-test-wp-rest-key-pair.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public function test_payload() {
299299
$time = time();
300300
$reserved = array(
301301
'iat' => $time, // Token issued at.
302-
'exp' => $time + ( DAY_IN_SECONDS * 7 ), // Token expiry.
302+
'exp' => $time + WEEK_IN_SECONDS, // Token expiry.
303303
'data' => array(
304304
'user' => array(
305305
'type' => 'wp_user',
@@ -318,7 +318,6 @@ public function test_payload() {
318318
);
319319

320320
$payload = $this->key_pair->payload( $reserved, $user );
321-
$this->assertEquals( $reserved['iat'] + ( DAY_IN_SECONDS * 365 ), $payload['exp'] );
322321
$this->assertEquals( $payload['data']['user']['api_key'], 12345 );
323322
}
324323

0 commit comments

Comments
 (0)