Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
29d1647
Bump version to 5.10.10
ragulka Sep 15, 2021
ad8dde4
Bump namespaces
ragulka Sep 15, 2021
eb854ed
Introduce CacheableRequestTrait
ragulka Sep 16, 2021
d421a4d
Add cacheable request unit tests
ragulka Sep 16, 2021
146ebc0
Load cacheable request trait in plugins
ragulka Sep 16, 2021
ee206dc
Add license
ragulka Sep 16, 2021
3f66181
Remove accidentally committed cache file
ragulka Sep 16, 2021
0fcbca2
Remove self return type
ragulka Sep 16, 2021
de2ccdf
Set method return types
ragulka Sep 16, 2021
f5317fd
Add request transient key getter
ragulka Sep 16, 2021
7da111a
Add method for checking if request is cacheable
ragulka Sep 16, 2021
924f554
Add missing use statement
ragulka Sep 16, 2021
7a50dbf
add methods to handle api response caching
ragulka Sep 16, 2021
c896a6e
Add response_loaded_from_cache flag to api base class
ragulka Sep 16, 2021
1c638f2
Handle response caching when performing API requests
ragulka Sep 16, 2021
b3032d4
Format boolean api log values as strings
ragulka Sep 16, 2021
e5272cd
Only log from_cache if the API request supports caching
ragulka Sep 16, 2021
30c1105
Set default cache lifetime to 24 hours
ragulka Sep 17, 2021
10a1590
Update CacheableRequestTraitTest.php
ragulka Sep 17, 2021
2b97971
code style tweaks
ragulka Sep 17, 2021
38d7809
Merge branch 'mwc-2477/add-cacheable-request-trait' into mwc-2478/sup…
ragulka Sep 17, 2021
b21912f
Allow filtering request cache lifetime
ragulka Sep 17, 2021
c962967
Allow filtering whether an API request is cacheable
ragulka Sep 17, 2021
dd85566
Remove the request cache transient key filter
ragulka Sep 17, 2021
e0b886e
Prefer using request getter on API base class
ragulka Sep 17, 2021
67aaa47
Add request URI to transient key params
ragulka Sep 17, 2021
64cdf97
Rename trait class & file
ragulka Sep 17, 2021
5304e7a
Add trait description, fix param ordering
ragulka Sep 17, 2021
3292e26
Use raw plugin_id in transient key, rename for clarity
ragulka Sep 17, 2021
416e364
make cache lifetime part of cache transient key
ragulka Sep 17, 2021
07b7ecc
Add should_cache property and setter/getter
ragulka Sep 20, 2021
7aa5a40
Add bypass_cache method and fix tests
ragulka Sep 20, 2021
432e2b4
Merge branch 'mwc-2477/add-cacheable-request-trait' into mwc-2478/sup…
ragulka Sep 20, 2021
5ce83e5
Extract cacheable api base into a separate abstract class
ragulka Sep 20, 2021
a5eb14e
Update require path
ragulka Sep 20, 2021
d2aa5b3
Merge branch 'mwc-2477/add-cacheable-request-trait' into mwc-2478/sup…
ragulka Sep 20, 2021
5ae8c53
Load cacheable api base
ragulka Sep 20, 2021
f826ebf
Allow child api classes to customize request broadcast data
ragulka Sep 20, 2021
04e4975
Add from_cache back to response data
ragulka Sep 20, 2021
a2c2b31
Broadcast request caching flags
ragulka Sep 20, 2021
6b280f8
Fix trait usage
ragulka Sep 20, 2021
10f3660
use mock for testing cacheable request trait
ragulka Sep 20, 2021
bd7ed43
add trait_exists and abspath check
ragulka Sep 20, 2021
6b19a32
move cacheable request to Traits namespace
ragulka Sep 20, 2021
7ad5989
apply code style suggestions
ragulka Sep 20, 2021
a86419b
Merge branch 'mwc-2477/add-cacheable-request-trait' into mwc-2478/sup…
ragulka Sep 20, 2021
ff5628e
Apply suggestions from code review
ragulka Sep 20, 2021
40b7162
Merge branch 'mwc-2478/support-cacheable-requests-in-api-base' of git…
ragulka Sep 20, 2021
9da897b
Update request trait description
ragulka Sep 20, 2021
c3606c6
add FW header, abspath & class_exists check, description, fix @since …
ragulka Sep 20, 2021
f0f6140
move cache flags to top of request/response data
ragulka Sep 20, 2021
ba57923
Merge pull request #552 from skyverge/mwc-2477/add-cacheable-request-…
ChaseWiseman Sep 21, 2021
5cd57f9
Add first integration test for cacheable api base abstract class
ragulka Sep 21, 2021
34822ea
undo accidental visibility change
ragulka Sep 21, 2021
373e239
fix test
ragulka Sep 21, 2021
5e69cd6
add tests for request lifetime getter
ragulka Sep 21, 2021
57e5f4b
test request transient key getter
ragulka Sep 21, 2021
4b284dd
Test reset_response
ragulka Sep 21, 2021
6396a75
Add test for is_response_loaded_from_cache
ragulka Sep 21, 2021
4366a01
Add tests for save/load response cache
ragulka Sep 21, 2021
5ca1740
add tests for request data
ragulka Sep 21, 2021
5c27625
Add test for get_response_data_for_broadcast
ragulka Sep 21, 2021
30c65b6
Add test for do_remote_request
ragulka Sep 21, 2021
7f21f6d
Add test for handle_response
ragulka Sep 21, 2021
6858440
fix test file code style
ragulka Sep 21, 2021
eb6dadd
dry up tests
ragulka Sep 21, 2021
29e0167
remove extra whitespace
ragulka Sep 21, 2021
09a5b18
Merge pull request #553 from skyverge/mwc-2478/support-cacheable-requ…
ChaseWiseman Sep 22, 2021
7e7c653
update changelog and package lock
ragulka Sep 22, 2021
9347495
compile assets
ragulka Sep 22, 2021
3ec00c9
fix percentage formatter test assertions
ragulka Sep 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "skyverge/wc-plugin-framework",
"description": "The official SkyVerge WooCommerce plugin framework",
"version": "5.10.9",
"version": "5.10.10",
"require-dev": {
"lucatume/wp-browser": "3.0.5",
"phpcompatibility/php-compatibility": "9.3.5",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wc-plugin-framework",
"version": "5.10.9",
"version": "5.10.10",
"title": "WooCommerce Plugin Framework",
"author": "SkyVerge Team",
"homepage": "https://github.com/skyverge/wc-plugin-framework#readme",
Expand Down
2 changes: 1 addition & 1 deletion tests/_archive/unit/Addresses/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace SkyVerge\WooCommerce\PluginFramework\Tests\Unit\Addresses;

use SkyVerge\WooCommerce\PluginFramework\Tests\Unit;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_9 as PluginFramework;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_10 as PluginFramework;

/**
* Unit tests for PluginFramework\Addresses\Address
Expand Down
2 changes: 1 addition & 1 deletion tests/_archive/unit/Addresses/Customer_Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace SkyVerge\WooCommerce\PluginFramework\Tests\Unit\Addresses;

use SkyVerge\WooCommerce\PluginFramework\Tests\Unit;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_9 as PluginFramework;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_10 as PluginFramework;

/**
* Unit tests for PluginFramework\Addresses\Address
Expand Down
10 changes: 5 additions & 5 deletions tests/_archive/unit/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use \WP_Mock as Mock;
use \Patchwork as p;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_9 as PluginFramework;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_10 as PluginFramework;

/**
* Helper Class Unit Tests
Expand All @@ -31,7 +31,7 @@ class Helper extends Test_Case {
public function test_str_starts_with_ascii( $asserts_as_true, $haystack, $needle ) {

// force ASCII handling
p\redefine( '\SkyVerge\WooCommerce\PluginFramework\v5_10_9\SV_WC_Helper::multibyte_loaded', function() { return false; } );
p\redefine( '\SkyVerge\WooCommerce\PluginFramework\v5_10_10\SV_WC_Helper::multibyte_loaded', function() { return false; } );

if ( $asserts_as_true ) {
$this->assertTrue( PluginFramework\SV_WC_Helper::str_starts_with( $haystack, $needle ) );
Expand Down Expand Up @@ -116,7 +116,7 @@ public function provider_str_starts_with_mb() {
public function test_str_ends_with_ascii( $asserts_as_true, $haystack, $needle ) {

// force ASCII handling
p\redefine( '\SkyVerge\WooCommerce\PluginFramework\v5_10_9\SV_WC_Helper::multibyte_loaded', function() { return false; } );
p\redefine( '\SkyVerge\WooCommerce\PluginFramework\v5_10_10\SV_WC_Helper::multibyte_loaded', function() { return false; } );

if ( $asserts_as_true ) {
$this->assertTrue( PluginFramework\SV_WC_Helper::str_ends_with( $haystack, $needle ) );
Expand Down Expand Up @@ -265,7 +265,7 @@ public function provider_test_str_to_sane_utf8() {
public function test_str_exists_ascii( $asserts_as_true, $haystack, $needle ) {

// force ASCII handling
p\redefine( '\SkyVerge\WooCommerce\PluginFramework\v5_10_9\SV_WC_Helper::multibyte_loaded', function() { return false; } );
p\redefine( '\SkyVerge\WooCommerce\PluginFramework\v5_10_10\SV_WC_Helper::multibyte_loaded', function() { return false; } );

if ( $asserts_as_true ) {
$this->assertTrue( PluginFramework\SV_WC_Helper::str_exists( $haystack, $needle ) );
Expand Down Expand Up @@ -346,7 +346,7 @@ public function provider_str_exists_mb() {
public function test_str_truncate_ascii() {

// force ASCII handling
p\redefine( '\SkyVerge\WooCommerce\PluginFramework\v5_10_9\SV_WC_Helper::multibyte_loaded', function() { return false; } );
p\redefine( '\SkyVerge\WooCommerce\PluginFramework\v5_10_10\SV_WC_Helper::multibyte_loaded', function() { return false; } );

$the_string = 'The quick brown fox jumps ಠ_ಠ';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace SkyVerge\WooCommerce\PluginFramework\Tests\Unit;

use \WP_Mock as Mock;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_9 as PluginFramework;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_10 as PluginFramework;

/**
* Unit tests for \SV_WC_Payment_Gateway_API_Response_Message_Helper
Expand Down
2 changes: 1 addition & 1 deletion tests/_archive/unit/payment-gateway-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace SkyVerge\WooCommerce\PluginFramework\Tests\Unit;

use \WP_Mock as Mock;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_9 as PluginFramework;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_10 as PluginFramework;

/**
* Unit tests for \SV_WC_Payment_Gateway_Helper
Expand Down
2 changes: 1 addition & 1 deletion tests/_archive/unit/payment-gateway-payment-token.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace SkyVerge\WooCommerce\PluginFramework\Tests\Unit;

use \WP_Mock as Mock;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_9 as PluginFramework;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_10 as PluginFramework;

/**
* Unit tests for \SV_WC_Payment_Gateway_Payment_Token
Expand Down
4 changes: 2 additions & 2 deletions tests/_archive/unit/payment-gateway/apple-pay-api-request.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace SkyVerge\WooCommerce\PluginFramework\Tests\Unit;

use \WP_Mock as Mock;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_9 as PluginFramework;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_10 as PluginFramework;

/**
* Unit tests for \SV_WC_Payment_Gateway_Apple_Pay_API_Request
Expand All @@ -21,7 +21,7 @@ class Payment_Gateway_Apple_Pay_API_Request extends Test_Case {
*/
public function test_set_merchant_data( $merchant_id, $domain_name, $display_name, $expected ) {

$gateway = $this->getMockBuilder( '\SkyVerge\WooCommerce\PluginFramework\v5_10_9\SV_WC_Payment_Gateway' )->getMock();
$gateway = $this->getMockBuilder( '\SkyVerge\WooCommerce\PluginFramework\v5_10_10\SV_WC_Payment_Gateway' )->getMock();

$request = new PluginFramework\SV_WC_Payment_Gateway_Apple_Pay_API_Request( $gateway );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace SkyVerge\WooCommerce\PluginFramework\Tests\Unit;

use \WP_Mock as Mock;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_9 as PluginFramework;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_10 as PluginFramework;

/**
* Unit tests for \SV_WC_Payment_Gateway_Apple_Pay_API_Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace SkyVerge\WooCommerce\PluginFramework\Tests\Unit;

use \WP_Mock as Mock;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_9 as PluginFramework;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_10 as PluginFramework;

/**
* Unit tests for \SV_WC_Payment_Gateway_Apple_Pay_Payment_Response
Expand Down
6 changes: 3 additions & 3 deletions tests/_archive/unit/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace SkyVerge\WooCommerce\PluginFramework\Tests\Unit;

use \WP_Mock as Mock;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_9 as PluginFramework;
use \SkyVerge\WooCommerce\PluginFramework\v5_10_10 as PluginFramework;

/**
* Plugin Test
Expand All @@ -15,7 +15,7 @@ class Plugin extends Test_Case {

public function test_constructor() {

$this->assertInstanceOf( '\SkyVerge\WooCommerce\PluginFramework\v5_10_9\SV_WC_Plugin', $this->plugin() );
$this->assertInstanceOf( '\SkyVerge\WooCommerce\PluginFramework\v5_10_10\SV_WC_Plugin', $this->plugin() );
}

public function test_clone() {
Expand Down Expand Up @@ -135,7 +135,7 @@ protected function plugin() {
),
);

return $this->getMockBuilder( '\SkyVerge\WooCommerce\PluginFramework\v5_10_9\SV_WC_Plugin' )
return $this->getMockBuilder( '\SkyVerge\WooCommerce\PluginFramework\v5_10_10\SV_WC_Plugin' )
->setConstructorArgs( $args )
->getMockForAbstractClass();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace SkyVerge\WooCommerce\GatewayTestPlugin;

use SkyVerge\WooCommerce\PluginFramework\v5_10_9 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_10_10 as Framework;

defined( 'ABSPATH' ) or exit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace SkyVerge\WooCommerce\GatewayTestPlugin;

use SkyVerge\WooCommerce\PluginFramework\v5_10_9 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_10_10 as Framework;

defined( 'ABSPATH' ) or exit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace SkyVerge\WooCommerce\GatewayTestPlugin;

use SkyVerge\WooCommerce\PluginFramework\v5_10_9 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_10_10 as Framework;

defined( 'ABSPATH' ) or exit;

Expand Down
2 changes: 1 addition & 1 deletion tests/_support/plugins/test-plugin/includes/API.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace SkyVerge\WooCommerce\TestPlugin;

use SkyVerge\WooCommerce\PluginFramework\v5_10_9 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_10_10 as Framework;

defined( 'ABSPATH' ) or exit;

Expand Down
2 changes: 1 addition & 1 deletion tests/_support/plugins/test-plugin/includes/Gateway.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace SkyVerge\WooCommerce\TestPlugin;

use SkyVerge\WooCommerce\PluginFramework\v5_10_9 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_10_10 as Framework;

defined( 'ABSPATH' ) or exit;

Expand Down
2 changes: 1 addition & 1 deletion tests/_support/plugins/test-plugin/includes/Plugin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace SkyVerge\WooCommerce\TestPlugin;

use SkyVerge\WooCommerce\PluginFramework\v5_10_9 as Framework;
use SkyVerge\WooCommerce\PluginFramework\v5_10_10 as Framework;

defined( 'ABSPATH' ) or exit;

Expand Down
Loading