diff --git wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set.php wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/result-set.php
index d37389633..b4f7bc15a 100644
|
|
echo Display::get_display_css(); ?> |
17 | 17 | $total_cols = 5; |
18 | 18 | foreach ( $revisions as $revision ) : |
19 | 19 | $rev_id = (int) ltrim( $revision->post_name, 'r' ); |
20 | | ?> |
| 20 | ?> |
21 | 21 | <tr> |
22 | 22 | <th colspan="<?php echo (int) $total_cols; ?>"><a href="<?php echo esc_url( sprintf( 'https://core.trac.wordpress.org/changeset/%d', $rev_id ) ); ?>">r<?php echo (int) $rev_id; ?></a>: <?php echo wp_kses_post( apply_filters( 'the_title', $revision->post_title ) ); ?></th> |
23 | 23 | </tr> |
24 | 24 | <?php |
25 | 25 | $query_args = array( |
26 | | 'posts_per_page' => 10, |
| 26 | 'posts_per_page' => $posts_per_page, |
27 | 27 | 'post_type' => 'result', |
28 | 28 | 'post_parent' => $revision->ID, |
29 | 29 | 'orderby' => 'post_title', |
… |
… |
echo Display::get_display_css(); ?> |
35 | 35 | $status = 'Errored'; |
36 | 36 | $status_title = 'No results found for test.'; |
37 | 37 | $results = get_post_meta( $report->ID, 'results', true ); |
38 | | if ( isset( $results['failures'] ) && ! empty( $results['tests'] ) ) { |
| 38 | if ( isset( $results['failures'] ) ) { |
39 | 39 | $status = 0 === (int) $results['failures'] && 0 === (int) $results['errors'] ? 'Passed' : 'Failed'; |
40 | 40 | $status_title = (int) $results['tests'] . ' tests, ' . (int) $results['failures'] . ' failed, ' . (int) $results['errors'] . ' errors'; |
41 | 41 | } |
… |
… |
echo Display::get_display_css(); ?> |
47 | 47 | $host .= '<a target="_blank" rel="nofollow" href="' . esc_url( $user->user_url ) . '">'; |
48 | 48 | } |
49 | 49 | $host .= get_avatar( |
50 | | $user->ID, 18, '', '', array( |
| 50 | $user->ID, |
| 51 | 18, |
| 52 | '', |
| 53 | '', |
| 54 | array( |
51 | 55 | 'extra_attr' => 'style="vertical-align: middle;margin-right:5px;"', |
52 | 56 | ) |
53 | 57 | ); |
… |
… |
echo Display::get_display_css(); ?> |
69 | 73 | <td><?php echo esc_html( Display::get_display_php_version( $report->ID ) ); ?></td> |
70 | 74 | <td><?php echo esc_html( Display::get_display_mysql_version( $report->ID ) ); ?></td> |
71 | 75 | </tr> |
72 | | <?php |
| 76 | <?php |
73 | 77 | endforeach; |
74 | 78 | else : |
75 | | ?> |
| 79 | ?> |
76 | 80 | <tr> |
77 | 81 | <td></td> |
78 | 82 | <td colspan="<?php echo (int) $total_cols - 1; ?>"> |
diff --git wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/single-result.php wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/parts/single-result.php
index 9a72d5dc7..2859e2362 100644
|
|
use PTR\Display; |
4 | 4 | $status = 'Errored'; |
5 | 5 | $status_title = 'No results found for test.'; |
6 | 6 | $results = get_post_meta( $report->ID, 'results', true ); |
7 | | if ( isset( $results['failures'] ) && ! empty( $results['tests'] ) ) { |
| 7 | if ( isset( $results['failures'] ) ) { |
8 | 8 | $status = 0 === (int) $results['failures'] && 0 === (int) $results['errors'] ? 'Passed' : 'Failed'; |
9 | 9 | $status_title = (int) $results['tests'] . ' tests, ' . (int) $results['failures'] . ' failed, ' . (int) $results['errors'] . ' errors'; |
10 | 10 | } |
… |
… |
if ( $user ) { |
16 | 16 | $host .= '<a target="_blank" rel="nofollow" href="' . esc_url( $user->user_url ) . '">'; |
17 | 17 | } |
18 | 18 | $host .= get_avatar( |
19 | | $user->ID, 18, '', '', array( |
| 19 | $user->ID, |
| 20 | 18, |
| 21 | '', |
| 22 | '', |
| 23 | array( |
20 | 24 | 'extra_attr' => 'style="vertical-align: middle;margin-right:5px;"', |
21 | 25 | ) |
22 | 26 | ); |
… |
… |
if ( $user ) { |
37 | 41 | <?php |
38 | 42 | $parent = get_post( $report->post_parent ); |
39 | 43 | if ( $parent ) : |
40 | | ?> |
| 44 | ?> |
41 | 45 | <p><a href="<?php echo esc_url( get_permalink( $parent ) ); ?>">← <?php echo esc_html( $parent->post_name ) . ': ' . apply_filters( 'the_title', get_the_title( $parent ) ); ?></a></p> |
42 | 46 | <?php endif; ?> |
43 | 47 | |
… |
… |
if ( $parent ) : |
73 | 77 | continue; |
74 | 78 | } |
75 | 79 | foreach ( $testsuite['testcases'] as $test_name => $testcase ) : |
76 | | ?> |
| 80 | ?> |
77 | 81 | <p><strong><?php echo esc_html( $suite_name . '::' . $test_name ); ?></strong></p> |
78 | 82 | <pre><?php echo ! empty( $testcase['failure'] ) ? $testcase['failure'] : $testcase['error']; ?></pre> |
79 | 83 | <?php endforeach; ?> |
diff --git wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/phpunit-test-reporter.php wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/phpunit-test-reporter.php
index 8decaefad..574c62b20 100644
|
|
|
1 | 1 | <?php |
2 | 2 | /** |
3 | 3 | * Plugin Name: PHPUnit Test Reporter |
4 | | * Plugin URI: https://make.wordpress.org/hosting/phpunit-test-results/ |
| 4 | * Plugin URI: https://make.wordpress.org/hosting/test-results/ |
5 | 5 | * Description: Captures and displays test results from the PHPUnit Test Runner |
6 | 6 | * Author: WordPress Hosting Community |
7 | 7 | * Author URI: https://make.wordpress.org/hosting/ |
8 | 8 | * Text Domain: ptr |
9 | 9 | * Domain Path: /languages |
10 | | * Version: 0.1.0 |
| 10 | * Version: 0.1.1 |
11 | 11 | * License: GPL v3 |
12 | 12 | * |
13 | 13 | * @package PTR |
diff --git wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/readme.txt wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/readme.txt
index 8d2796318..e4c9f551a 100644
|
|
|
1 | 1 | === PHPUnit Test Reporter === |
2 | | Contributors: octalmage, danielbachhuber |
| 2 | Contributors: octalmage, danielbachhuber, mikeschroder, pfefferle |
3 | 3 | Tags: phpunit |
4 | 4 | Requires at least: 4.7 |
5 | | Tested up to: 4.8 |
6 | | Stable tag: 0.1.0 |
| 5 | Tested up to: 5.4.1 |
| 6 | Stable tag: 0.1.1 |
7 | 7 | License: GPLv3 |
8 | 8 | License URI: http://www.gnu.org/licenses/gpl-3.0.html |
9 | 9 | |
… |
… |
Captures and displays test results from the PHPUnit Test Runner |
11 | 11 | |
12 | 12 | == Description == |
13 | 13 | |
14 | | Captures and displays test results from the PHPUnit Test Runner |
| 14 | Captures and displays test results from the [PHPUnit Test Runner](https://github.com/WordPress/phpunit-test-runner). |
15 | 15 | |
16 | 16 | For more details, [please read through the project overview](https://make.wordpress.org/hosting/test-results-getting-started/). |
17 | 17 | |
| 18 | == Contributing == |
| 19 | |
| 20 | There’s a Docker environment with several tools built in for testing. |
| 21 | To configure it, run `make` and it will automatically run `docker-compose`. |
| 22 | After that, to view the test environment, visit http://localhost:8080. |
| 23 | |
| 24 | Usage: |
| 25 | - `make` or `make start`: Builds a Docker environment for testing. |
| 26 | - `make stop`: Stops Docker test environment. |
| 27 | - `make shell`: SSH to Docker test environment. |
| 28 | - `make test`: Runs `php-unit` and `phpcs` in Docker test environment. |
| 29 | |
18 | 30 | == Changelog == |
19 | 31 | |
20 | 32 | = 0.1.0 (August 21st, 2017) = |
21 | 33 | * Initial release. |
| 34 | |
| 35 | = 0.1.1 (May 12th, 2020) = |
| 36 | * Updates for coding standards. |
| 37 | * Update local and Travis CI builds. |
| 38 | * Reduce number of revisions in index, while increasing max reporters shown. |
| 39 | * Add contributor documentation. |
diff --git wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-content-model.php wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-content-model.php
index ba21485d8..64a153fda 100644
|
|
class Content_Model { |
50 | 50 | public static function action_init_register_role() { |
51 | 51 | if ( ! get_role( 'test-reporter' ) ) { |
52 | 52 | add_role( |
53 | | 'test-reporter', __( 'Test Reporter', 'ptr' ), array( |
| 53 | 'test-reporter', |
| 54 | __( 'Test Reporter', 'ptr' ), |
| 55 | array( |
54 | 56 | 'read' => true, |
55 | 57 | ) |
56 | 58 | ); |
diff --git wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-display.php wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-display.php
index a0edaa2fe..a1429c69a 100644
|
|
class Display { |
67 | 67 | |
68 | 68 | if ( get_queried_object()->post_parent ) { |
69 | 69 | $content = ptr_get_template_part( |
70 | | 'single-result', array( |
| 70 | 'single-result', |
| 71 | array( |
71 | 72 | 'report' => get_queried_object(), |
72 | 73 | ) |
73 | 74 | ); |
74 | 75 | } else { |
75 | 76 | $content = ptr_get_template_part( |
76 | | 'result-set', array( |
77 | | 'revisions' => array( |
| 77 | 'result-set', |
| 78 | array( |
| 79 | 'posts_per_page' => 500, |
| 80 | 'revisions' => array( |
78 | 81 | get_queried_object(), |
79 | 82 | ), |
80 | 83 | ) |
… |
… |
class Display { |
92 | 95 | |
93 | 96 | $output = ''; |
94 | 97 | $query_args = array( |
95 | | 'posts_per_page' => 5, |
| 98 | 'posts_per_page' => 3, |
96 | 99 | 'post_type' => 'result', |
97 | 100 | 'post_parent' => 0, |
98 | 101 | 'orderby' => 'post_name', |
… |
… |
class Display { |
118 | 121 | $output .= self::get_reporter_avatars(); |
119 | 122 | } |
120 | 123 | $output .= ptr_get_template_part( |
121 | | 'result-set', array( |
122 | | 'revisions' => $rev_query->posts, |
| 124 | 'result-set', |
| 125 | array( |
| 126 | 'posts_per_page' => 50, |
| 127 | 'revisions' => $rev_query->posts, |
123 | 128 | ) |
124 | 129 | ); |
125 | 130 | ob_start(); |
diff --git wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-restapi.php wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-restapi.php
index 58256774b..4fe985de6 100644
|
|
class RestAPI { |
12 | 12 | */ |
13 | 13 | public static function register_routes() { |
14 | 14 | register_rest_route( |
15 | | 'wp-unit-test-api/v1', 'results', array( |
| 15 | 'wp-unit-test-api/v1', |
| 16 | 'results', |
| 17 | array( |
16 | 18 | 'methods' => 'POST', |
17 | 19 | 'callback' => array( __CLASS__, 'add_results_callback' ), |
18 | 20 | 'args' => array( |
… |
… |
class RestAPI { |
51 | 53 | case 'commit': |
52 | 54 | if ( ! is_numeric( $value ) ) { |
53 | 55 | return new WP_Error( |
54 | | 'rest_invalid', __( 'Value must be numeric.', 'ptr' ), array( |
| 56 | 'rest_invalid', |
| 57 | __( 'Value must be numeric.', 'ptr' ), |
| 58 | array( |
55 | 59 | 'status' => 400, |
56 | 60 | ) |
57 | 61 | ); |
… |
… |
class RestAPI { |
60 | 64 | case 'message': |
61 | 65 | if ( empty( $value ) || ! is_string( $value ) ) { |
62 | 66 | return new WP_Error( |
63 | | 'rest_invalid', __( 'Value must be a non-empty string.', 'ptr' ), array( |
| 67 | 'rest_invalid', |
| 68 | __( 'Value must be a non-empty string.', 'ptr' ), |
| 69 | array( |
64 | 70 | 'status' => 400, |
65 | 71 | ) |
66 | 72 | ); |
… |
… |
class RestAPI { |
70 | 76 | case 'results': |
71 | 77 | if ( null === json_decode( $value ) ) { |
72 | 78 | return new WP_Error( |
73 | | 'rest_invalid', __( 'Value must be encoded JSON.', 'ptr' ), array( |
| 79 | 'rest_invalid', |
| 80 | __( 'Value must be encoded JSON.', 'ptr' ), |
| 81 | array( |
74 | 82 | 'status' => 400, |
75 | 83 | ) |
76 | 84 | ); |
… |
… |
class RestAPI { |
78 | 86 | return true; |
79 | 87 | } |
80 | 88 | return new WP_Error( |
81 | | 'rest_invalid', __( 'Invalid key specified.', 'ptr' ), array( |
| 89 | 'rest_invalid', |
| 90 | __( 'Invalid key specified.', 'ptr' ), |
| 91 | array( |
82 | 92 | 'status' => 400, |
83 | 93 | ) |
84 | 94 | ); |
… |
… |
class RestAPI { |
87 | 97 | public static function permission() { |
88 | 98 | if ( ! current_user_can( 'edit_results' ) ) { |
89 | 99 | return new WP_Error( |
90 | | 'rest_unauthorized', __( 'Sorry, you are not allowed to create results.', 'ptr' ), array( |
| 100 | 'rest_unauthorized', |
| 101 | __( 'Sorry, you are not allowed to create results.', 'ptr' ), |
| 102 | array( |
91 | 103 | 'status' => is_user_logged_in() ? 403 : 401, |
92 | 104 | ) |
93 | 105 | ); |