From 081cecbbbde718fff8a8a2f13a5b6e3565573028 Mon Sep 17 00:00:00 2001 From: Luke Carbis Date: Wed, 15 Mar 2017 11:05:29 +1000 Subject: [PATCH 1/5] Minor readme tweak --- readme.md | 4 +++- readme.txt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index ef29b883a..072add6a0 100755 --- a/readme.md +++ b/readme.md @@ -11,6 +11,8 @@ Planes have a black box, WordPress has Stream. When something goes wrong, you ne **Stable tag:** 3.2 **License:** [GPLv2 or later](https://www.gnu.org/licenses/gpl-2.0.html) +[![Build Status](https://travis-ci.org/xwp/stream.svg?branch=master)](https://travis-ci.org/xwp/stream) [![Join the chat at https://gitter.im/xwp/stream](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/xwp/stream) + ## Description ## With Stream, you're never left in the dark about WordPress Admin activity. @@ -89,7 +91,7 @@ Thank you for wanting to make Stream better for everyone! ## Changelog ## -### 3.2 - March 15, 2017 ### +### 3.2.0 - March 15, 2017 ### * New: Stream now support alternate Database Drivers. ([#889](https://github.com/xwp/stream/pull/889)) * Fix: Exclude dropdown menus ([e5c8677](https://github.com/xwp/stream/commit/e5c8677), [3626ba8](https://github.com/xwp/stream/commit/3626ba8), [e923a92](https://github.com/xwp/stream/commit/e923a92)) * Fix: Prevent loading of connectors on frontend ([ed3a635](https://github.com/xwp/stream/commit/ed3a635)) diff --git a/readme.txt b/readme.txt index 84dc4444b..31f5bfdf3 100644 --- a/readme.txt +++ b/readme.txt @@ -79,7 +79,7 @@ Thank you for wanting to make Stream better for everyone! == Changelog == -= 3.2 - March 15, 2017 = += 3.2.0 - March 15, 2017 = * New: Stream now support alternate Database Drivers. ([#889](https://github.com/xwp/stream/pull/889)) * Fix: Exclude dropdown menus ([e5c8677](https://github.com/xwp/stream/commit/e5c8677), [3626ba8](https://github.com/xwp/stream/commit/3626ba8), [e923a92](https://github.com/xwp/stream/commit/e923a92)) From 4017b3188a64417829c2bcdc85ad31c89b612007 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Tue, 3 Apr 2018 16:03:57 +0200 Subject: [PATCH 2/5] add microseconds to setTime --- includes/lib/Carbon.php | 5 +++-- tests/tests/test-class-export.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/includes/lib/Carbon.php b/includes/lib/Carbon.php index 2c0c3e99d..dbf58796a 100644 --- a/includes/lib/Carbon.php +++ b/includes/lib/Carbon.php @@ -675,12 +675,13 @@ public function second($value) * @param integer $hour * @param integer $minute * @param integer $second + * @param integer $microseconds * * @return static */ - public function setTime($hour, $minute, $second = 0) + public function setTime($hour, $minute, $second = 0, $microseconds = 0 ) { - parent::setTime($hour, $minute, $second); + parent::setTime($hour, $minute, $second, $microseconds ); return $this; } diff --git a/tests/tests/test-class-export.php b/tests/tests/test-class-export.php index 8b56d310d..3758f495d 100644 --- a/tests/tests/test-class-export.php +++ b/tests/tests/test-class-export.php @@ -129,7 +129,7 @@ public function test_register_exporters() { /** * Test registering a invalid class type produces an error * - * @expectedException PHPUnit_Framework_Error + * @expectedException PHPUnit_Framework_Error_Notice */ public function test_register_exporter_invalid_class() { add_filter( 'wp_stream_exporters', function( $exporters ) { From d4e7cee1993bb64445667ad0ccb1c4a5755f14d9 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Tue, 3 Apr 2018 16:48:36 +0200 Subject: [PATCH 3/5] use expectException over setExpectedException --- tests/tests/test-class-admin.php | 2 +- tests/tests/test-class-alerts.php | 13 ++++++++++--- tests/tests/test-class-export.php | 3 +-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/tests/test-class-admin.php b/tests/tests/test-class-admin.php index 3c859cb2d..7131dfd42 100644 --- a/tests/tests/test-class-admin.php +++ b/tests/tests/test-class-admin.php @@ -384,7 +384,7 @@ public function test_ajax_filters() { $_POST['q'] = $user->display_name; $_POST['nonce'] = wp_create_nonce( 'stream_filters_user_search_nonce' ); - $this->setExpectedException( 'WPAjaxDieStopException' ); + $this->expectException( 'WPAjaxDieStopException' ); try { $this->_handleAjax( 'wp_stream_filters' ); diff --git a/tests/tests/test-class-alerts.php b/tests/tests/test-class-alerts.php index 10de9b57b..b725eca9b 100644 --- a/tests/tests/test-class-alerts.php +++ b/tests/tests/test-class-alerts.php @@ -33,8 +33,11 @@ function test_load_alert_types() { $this->assertEquals( 1, $action->get_call_count() ); } + /** + * @group test + * @expectedException PHPUnit_Framework_Error_Notice + */ function test_load_bad_alert_type() { - $this->setExpectedException( 'PHPUnit_Framework_Error_Notice' ); add_filter( 'wp_stream_alert_types', array( $this, 'callback_load_bad_alert_register' ), 10, 1 ); $alerts = new Alerts( $this->plugin ); @@ -56,8 +59,10 @@ function test_load_alert_triggers() { $this->assertEquals( 1, $action->get_call_count() ); } + /** + * @expectedException PHPUnit_Framework_Error_Notice + */ function test_load_bad_alert_trigger() { - $this->setExpectedException( 'PHPUnit_Framework_Error_Notice' ); add_filter( 'wp_stream_alert_triggers', array( $this, 'callback_load_bad_alert_register' ), 10, 1 ); $alerts = new Alerts( $this->plugin ); @@ -350,6 +355,7 @@ function test_save_new_alert_with_child_context() { $this->assertObjectHasAttribute( 'success', $response ); $this->assertTrue( $response->success ); } + function test_save_new_alert_no_nonce() { $alerts = new Alerts( $this->plugin ); try { @@ -357,7 +363,8 @@ function test_save_new_alert_no_nonce() { $_POST['wp_stream_trigger_context'] = 'posts-post'; $_POST['wp_stream_trigger_action'] = 'edit'; $_POST['wp_stream_alert_type'] = 'highlight'; - $this->setExpectedException( 'WPAjaxDieStopException' ); + + $this->expectException( 'WPAjaxDieStopException' ); $this->_handleAjax( 'save_new_alert' ); } catch ( \WPAjaxDieContinueException $e ) { $exception = $e; diff --git a/tests/tests/test-class-export.php b/tests/tests/test-class-export.php index 3758f495d..f2b96cf47 100644 --- a/tests/tests/test-class-export.php +++ b/tests/tests/test-class-export.php @@ -128,8 +128,6 @@ public function test_register_exporters() { /** * Test registering a invalid class type produces an error - * - * @expectedException PHPUnit_Framework_Error_Notice */ public function test_register_exporter_invalid_class() { add_filter( 'wp_stream_exporters', function( $exporters ) { @@ -137,6 +135,7 @@ public function test_register_exporter_invalid_class() { remove_all_filters( 'wp_stream_exporters' ); return $exporters; }); + $this->expectException('PHPUnit_Framework_Error_Notice'); $this->export->register_exporters(); } From 075c39dfe8fd7fb4cec5bc6857ada4424e4213c7 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Tue, 3 Apr 2018 17:03:10 +0200 Subject: [PATCH 4/5] Mark phpunit version requires on exception testing --- tests/tests/test-class-admin.php | 5 ++++- tests/tests/test-class-alerts.php | 3 +++ tests/tests/test-class-export.php | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/tests/test-class-admin.php b/tests/tests/test-class-admin.php index 7131dfd42..306430ea3 100644 --- a/tests/tests/test-class-admin.php +++ b/tests/tests/test-class-admin.php @@ -372,8 +372,11 @@ public function test_filter_role_caps() { $this->assertFalse( $role->has_cap( $this->admin->view_cap ) ); } - /* + /** + * Test Ajax Filters + * * @group ajax + * @requires PHPUnit 5.7 */ public function test_ajax_filters() { $user = new \WP_User( get_current_user_id() ); diff --git a/tests/tests/test-class-alerts.php b/tests/tests/test-class-alerts.php index b725eca9b..667ac7f60 100644 --- a/tests/tests/test-class-alerts.php +++ b/tests/tests/test-class-alerts.php @@ -356,6 +356,9 @@ function test_save_new_alert_with_child_context() { $this->assertTrue( $response->success ); } + /** + * @requires PHPUnit 5.7 + */ function test_save_new_alert_no_nonce() { $alerts = new Alerts( $this->plugin ); try { diff --git a/tests/tests/test-class-export.php b/tests/tests/test-class-export.php index f2b96cf47..9eb8a5a92 100644 --- a/tests/tests/test-class-export.php +++ b/tests/tests/test-class-export.php @@ -128,6 +128,8 @@ public function test_register_exporters() { /** * Test registering a invalid class type produces an error + * + * @requires PHPUnit 5.7 */ public function test_register_exporter_invalid_class() { add_filter( 'wp_stream_exporters', function( $exporters ) { From a94e2da97cd9993fac3ae096bf27212b40f198d1 Mon Sep 17 00:00:00 2001 From: David Cramer Date: Wed, 4 Apr 2018 09:08:14 +0200 Subject: [PATCH 5/5] Remove exception testing --- tests/tests/test-class-alerts.php | 7 +++---- tests/tests/test-class-export.php | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/tests/test-class-alerts.php b/tests/tests/test-class-alerts.php index a13e1d7c5..b1d2f9eb4 100644 --- a/tests/tests/test-class-alerts.php +++ b/tests/tests/test-class-alerts.php @@ -34,8 +34,7 @@ function test_load_alert_types() { } /** - * @group test - * @expectedException PHPUnit_Framework_Error_Notice + * @requires PHPUnit 5.7 */ function test_load_bad_alert_type() { $alerts = new Alerts( $this->plugin ); @@ -65,7 +64,7 @@ function test_load_alert_triggers() { } /** - * @expectedException PHPUnit_Framework_Error_Notice + * Test bad trigger is not added. */ function test_load_bad_alert_trigger() { $alerts = new Alerts( $this->plugin ); @@ -80,7 +79,7 @@ function test_load_bad_alert_trigger() { } function callback_load_bad_alert_register( $classes ) { - $classes['bad_alert_trigger'] = new \stdClass; + $classes['bad_alert_trigger'] = new \stdClass(); return $classes; } diff --git a/tests/tests/test-class-export.php b/tests/tests/test-class-export.php index 9eb8a5a92..eccae02f4 100644 --- a/tests/tests/test-class-export.php +++ b/tests/tests/test-class-export.php @@ -128,18 +128,18 @@ public function test_register_exporters() { /** * Test registering a invalid class type produces an error - * * @requires PHPUnit 5.7 */ public function test_register_exporter_invalid_class() { add_filter( 'wp_stream_exporters', function( $exporters ) { - $exporters['test'] = new \stdClass; + $exporters['test'] = new \stdClass(); remove_all_filters( 'wp_stream_exporters' ); return $exporters; }); - $this->expectException('PHPUnit_Framework_Error_Notice'); - $this->export->register_exporters(); + + $exporters = $this->export->get_exporters(); + $this->assertFalse( isset( $exporters['test'] ) ); } /**