PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.8.2
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.8.2
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / classes / WpMatomo / Ecommerce / MatomoTestEcommerce.php
matomo / classes / WpMatomo / Ecommerce Last commit date
Base.php 10 months ago EasyDigitalDownloads.php 4 years ago MatomoTestEcommerce.php 10 months ago MemberPress.php 3 months ago ServerSideVisitorId.php 1 year ago Woocommerce.php 4 months ago
MatomoTestEcommerce.php
77 lines
1 <?php
2
3 namespace WpMatomo\Ecommerce;
4
5 /**
6 * this class is required only for phpunit tests.
7 * It allow to change the visibility of some methods of the Base class
8 * and so allow to test them in the unit tests
9 *
10 * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod.Found
11 */
12 class MatomoTestEcommerce extends Base {
13
14 public $should_track_background = false;
15
16 public $supports_delayed_tracking = false;
17
18 public $session_data = [];
19
20 public $tracked_orders = [];
21
22 /**
23 * Render public the wrap_script method. Required for the unit tests
24 *
25 * @param string $script
26 *
27 * @return string
28 * @see Base::wrap_script()
29 */
30 public function wrap_script( $script ) {
31 return parent::wrap_script( $script );
32 }
33
34 /**
35 * Render public the wrap_script method. Required for the unit tests
36 *
37 * @param [] $params
38 *
39 * @return string
40 * @see Base::make_matomo_js_tracker_call()
41 */
42 public function make_matomo_js_tracker_call( $params ) {
43 return parent::make_matomo_js_tracker_call( $params );
44 }
45
46 protected function should_track_background() {
47 return $this->should_track_background;
48 }
49
50 protected function get_tracking_calls_in_session() {
51 return $this->session_data['ajax_calls'];
52 }
53
54 protected function add_tracking_calls_to_session( $data ) {
55 $this->session_data['ajax_calls'][] = $data;
56 }
57
58 protected function remove_tracking_calls_in_session() {
59 $this->session_data['ajax_calls'] = [];
60 }
61
62 /**
63 * @return bool
64 */
65 public function supports_delayed_tracking() {
66 return $this->supports_delayed_tracking;
67 }
68
69 public function set_order_been_tracked( $order_id ) {
70 $this->tracked_orders[] = $order_id;
71 }
72
73 public function has_order_been_tracked_already( $order_id ) {
74 return in_array( $order_id, $this->tracked_orders, true );
75 }
76 }
77