PluginProbe ʕ •ᴥ•ʔ
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / trunk
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode vtrunk
4.7.2 4.7.1 trunk 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 3.0.0 3.0.1 3.1.0 3.10.0 3.10.1 3.11.1 3.11.2 3.11.3 3.2.0 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.5 3.6.6 3.7.0 3.7.1 3.8.0 3.9.0 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.2.0 4.2.1 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.3.10 4.3.11 4.3.12 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.7.1 4.3.8 4.3.9 4.3.9.1 4.4.0 4.4.1 4.4.2 4.5.0 4.5.1 4.5.10 4.5.11 4.5.2 4.5.3 4.5.4 4.5.5 4.5.6 4.5.7 4.5.8 4.5.9 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.7.0
cookiebot / tests / integration / addons / Test_Official_Facebook_Pixel.php
cookiebot / tests / integration / addons Last commit date
Test_Add_To_Any.php 1 year ago Test_Addthis.php 1 year ago Test_CAOS_Host_Analyticsjs_Local_Version_1_97.php 1 year ago Test_Caos_Host_Analyticsjs_Local.php 1 year ago Test_Custom_Facebook_Feed.php 4 months ago Test_Custom_Facebook_Feed_Version_2_17_1.php 1 year ago Test_Enhanced_Ecommerce_For_Woocommerce_Store.php 1 year ago Test_Facebook_For_Woocommerce.php 1 year ago Test_Ga_Google_Analytics.php 1 year ago Test_Gadwp.php 1 year ago Test_Google_Analyticator.php 1 year ago Test_Google_Analytics.php 1 year ago Test_Google_Site_Kit.php 10 months ago Test_Hubspot_Leadin.php 1 year ago Test_Hubspot_Tracking_Code.php 1 year ago Test_Instagram_Feed.php 4 months ago Test_Jetpack_Widgets.php 1 year ago Test_Lightspeed_Cache.php 1 year ago Test_Ninja_Forms.php 1 year ago Test_Official_Facebook_Pixel.php 4 months ago Test_Optinmonster.php 1 year ago Test_Pixel_Caffeine.php 1 year ago Test_Simple_Share_Buttons_Adder.php 1 year ago Test_Wd_Google_Analytics.php 1 year ago Test_Wp_Analytify.php 1 year ago Test_Wp_Google_Analytics_Events.php 1 year ago Test_Wp_Piwik.php 1 year ago Test_Wp_Seopress.php 4 months ago
Test_Official_Facebook_Pixel.php
341 lines
1 <?php
2
3 namespace cybot\cookiebot\tests\integration\addons;
4
5 use cybot\cookiebot\addons\controller\addons\official_facebook_pixel\Official_Facebook_Pixel;
6 use PHPUnit\Framework\ExpectationFailedException;
7 use SebastianBergmann\RecursionContext\InvalidArgumentException;
8 use WP_UnitTestCase;
9
10 class Test_Official_Facebook_Pixel extends WP_UnitTestCase {
11
12 /**
13 * @covers \cybot\cookiebot\addons\controller\addons\official_facebook_pixel\Official_Facebook_Pixel
14 * @throws ExpectationFailedException
15 * @throws InvalidArgumentException
16 * @throws \Exception
17 */
18 public function test_official_facebook_pixel_pageview() {
19 $content = Official_Facebook_Pixel::get_svn_file_content( 'core/class-facebookpixel.php' );
20 $snippet = <<<TEXT
21 <!-- Meta Pixel Code -->
22 <script type='text/javascript'>
23 !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
24 n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
25 n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
26 t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
27 document,'script','https://connect.facebook.net/en_US/fbevents.js');
28 </script>
29 <!-- End Meta Pixel Code -->
30 TEXT;
31
32 $this->assertNotFalse( strpos( $content, $snippet ) );
33 }
34
35 /**
36 * @covers \cybot\cookiebot\addons\controller\addons\official_facebook_pixel\Official_Facebook_Pixel
37 * @throws ExpectationFailedException
38 * @throws InvalidArgumentException
39 * @throws \Exception
40 */
41 public function test_official_facebook_pixel_caldera_form() {
42 $content = Official_Facebook_Pixel::get_svn_file_content( 'integration/class-facebookwordpresscalderaform.php' );
43 $snippet = <<<TEXT
44 add_action(
45 'caldera_forms_ajax_return',
46 array( __CLASS__, 'injectLeadEvent' ),
47 10,
48 2
49 );
50 TEXT;
51
52 $this->assertNotFalse( strpos( $content, $snippet ) );
53 }
54
55 /**
56 * @covers \cybot\cookiebot\addons\controller\addons\official_facebook_pixel\Official_Facebook_Pixel
57 * @throws ExpectationFailedException
58 * @throws InvalidArgumentException
59 * @throws \Exception
60 */
61 public function test_official_facebook_pixel_contact_form_7() {
62 $content = Official_Facebook_Pixel::get_svn_file_content( 'integration/class-facebookwordpresscontactform7.php' );
63 $snippets[] = <<<TEXT
64 add_action(
65 'wpcf7_submit',
66 array( __CLASS__, 'trackServerEvent' ),
67 10,
68 2
69 );
70 TEXT;
71
72 $snippets[] = <<<TEXT
73 add_action(
74 'wpcf7_feedback_response',
75 array( __CLASS__, 'injectLeadEvent' ),
76 20,
77 2
78 );
79 TEXT;
80
81 foreach ( $snippets as $snippet ) {
82 $this->assertNotFalse( strpos( $content, $snippet ) );
83 }
84 }
85
86 /**
87 * @covers \cybot\cookiebot\addons\controller\addons\official_facebook_pixel\Official_Facebook_Pixel
88 * @throws ExpectationFailedException
89 * @throws InvalidArgumentException
90 * @throws \Exception
91 */
92 public function test_official_facebook_pixel_formidable_form() {
93 $content = Official_Facebook_Pixel::get_svn_file_content( 'integration/class-facebookwordpressformidableform.php' );
94 $snippets[] = <<<TEXT
95 add_action(
96 'frm_after_create_entry',
97 array( __CLASS__, 'trackServerEvent' ),
98 20,
99 2
100 );
101 TEXT;
102
103 $snippets[] = <<<TEXT
104 add_action(
105 'wp_footer',
106 array( __CLASS__, 'injectLeadEvent' ),
107 20
108 );
109 TEXT;
110
111 foreach ( $snippets as $snippet ) {
112 $this->assertNotFalse( strpos( $content, $snippet ) );
113 }
114 }
115
116 /**
117 * @covers \cybot\cookiebot\addons\controller\addons\official_facebook_pixel\Official_Facebook_Pixel
118 * @throws ExpectationFailedException
119 * @throws InvalidArgumentException
120 * @throws \Exception
121 */
122 public function test_official_facebook_pixel_easy_digital_downloads() {
123 $content = Official_Facebook_Pixel::get_svn_file_content( 'integration/class-facebookwordpresseasydigitaldownloads.php' );
124 $snippets[] = <<<TEXT
125 add_action(
126 'edd_payment_receipt_after',
127 array( __CLASS__, 'trackPurchaseEvent' ),
128 10,
129 2
130 );
131 TEXT;
132
133 $snippets[] = <<<TEXT
134 add_action(
135 'edd_after_download_content',
136 array( __CLASS__, 'injectAddToCartListener' )
137 );
138 TEXT;
139
140 $snippets[] = <<<TEXT
141 self::add_pixel_fire_for_hook(
142 array(
143 'hook_name' => 'edd_after_checkout_cart',
144 'classname' => __CLASS__,
145 'inject_function' => 'injectInitiateCheckoutEvent',
146 )
147 );
148 TEXT;
149
150 $snippets[] = <<<TEXT
151 add_action(
152 'edd_after_download_content',
153 array( __CLASS__, 'injectViewContentEvent' ),
154 40,
155 1
156 );
157 TEXT;
158
159 foreach ( $snippets as $snippet ) {
160 $this->assertNotFalse( strpos( $content, $snippet ) );
161 }
162 }
163
164 /**
165 * @covers \cybot\cookiebot\addons\controller\addons\official_facebook_pixel\Official_Facebook_Pixel
166 * @throws ExpectationFailedException
167 * @throws InvalidArgumentException
168 * @throws \Exception
169 */
170 public function test_official_facebook_pixel_mailchimp_for_wp() {
171 $content = Official_Facebook_Pixel::get_svn_file_content( 'integration/class-facebookwordpressmailchimpforwp.php' );
172 $snippet = <<<TEXT
173 self::add_pixel_fire_for_hook(
174 array(
175 'hook_name' => 'mc4wp_form_subscribed',
176 'classname' => __CLASS__,
177 'inject_function' => 'injectLeadEvent',
178 )
179 );
180 TEXT;
181
182 $this->assertNotFalse( strpos( $content, $snippet ) );
183 }
184
185 /**
186 * @covers \cybot\cookiebot\addons\controller\addons\official_facebook_pixel\Official_Facebook_Pixel
187 * @throws ExpectationFailedException
188 * @throws InvalidArgumentException
189 * @throws \Exception
190 */
191 public function test_official_facebook_pixel_ninja_forms() {
192 $content = Official_Facebook_Pixel::get_svn_file_content( 'integration/class-facebookwordpressninjaforms.php' );
193 $snippet = <<<TEXT
194 add_action(
195 'ninja_forms_submission_actions',
196 array( __CLASS__, 'injectLeadEvent' ),
197 10,
198 3
199 );
200 TEXT;
201
202 $this->assertNotFalse( strpos( $content, $snippet ) );
203 }
204
205 /**
206 * @covers \cybot\cookiebot\addons\controller\addons\official_facebook_pixel\Official_Facebook_Pixel
207 * @throws ExpectationFailedException
208 * @throws InvalidArgumentException
209 * @throws \Exception
210 */
211 public function test_official_facebook_pixel_woocommerce() {
212 $content = Official_Facebook_Pixel::get_svn_file_content( 'integration/class-facebookwordpresswoocommerce.php' );
213 $snippets[] = <<<TEXT
214 add_action(
215 'woocommerce_after_checkout_form',
216 array( __CLASS__, 'trackInitiateCheckout' ),
217 40
218 );
219 TEXT;
220
221 $snippets[] = <<<TEXT
222 add_action(
223 'woocommerce_add_to_cart',
224 array( __CLASS__, 'trackAddToCartEvent' ),
225 40,
226 4
227 );
228 TEXT;
229
230 $snippets[] = <<<TEXT
231 add_action(
232 'woocommerce_thankyou',
233 array( __CLASS__, 'trackPurchaseEvent' ),
234 40
235 );
236 TEXT;
237
238 $snippets[] = <<<TEXT
239 add_action(
240 'woocommerce_payment_complete',
241 array( __CLASS__, 'trackPurchaseEvent' ),
242 40
243 );
244 TEXT;
245
246 foreach ( $snippets as $snippet ) {
247 $this->assertNotFalse( strpos( $content, $snippet ) );
248 }
249 }
250
251 /**
252 * @covers \cybot\cookiebot\addons\controller\addons\official_facebook_pixel\Official_Facebook_Pixel
253 * @throws ExpectationFailedException
254 * @throws InvalidArgumentException
255 * @throws \Exception
256 */
257 public function test_official_facebook_pixel_WPECommerce() {
258 $content = Official_Facebook_Pixel::get_svn_file_content( 'integration/class-facebookwordpresswpecommerce.php' );
259 $snippets[] = <<<TEXT
260 add_action(
261 'wpsc_add_to_cart_json_response',
262 array( __CLASS__, 'injectAddToCartEvent' ),
263 11
264 );
265 TEXT;
266
267 $snippets[] = <<<TEXT
268 self::add_pixel_fire_for_hook(
269 array(
270 'hook_name' => 'wpsc_before_shopping_cart_page',
271 'classname' => __CLASS__,
272 'inject_function' => 'injectInitiateCheckoutEvent',
273 )
274 );
275 TEXT;
276
277 $snippets[] = <<<TEXT
278 add_action(
279 'wpsc_transaction_results_shutdown',
280 array( __CLASS__, 'injectPurchaseEvent' ),
281 11,
282 3
283 );
284 TEXT;
285
286 foreach ( $snippets as $snippet ) {
287 $this->assertNotFalse( strpos( $content, $snippet ) );
288 }
289 }
290
291 /**
292 * @covers \cybot\cookiebot\addons\controller\addons\official_facebook_pixel\Official_Facebook_Pixel
293 * @throws ExpectationFailedException
294 * @throws InvalidArgumentException
295 * @throws \Exception
296 */
297 public function test_official_facebook_pixel_wp_forms() {
298 $content = Official_Facebook_Pixel::get_svn_file_content( 'integration/class-facebookwordpresswpforms.php' );
299 $snippets[] = <<<TEXT
300 add_action(
301 'wp_footer',
302 array( __CLASS__, 'injectLeadEvent' ),
303 20
304 );
305 TEXT;
306
307 $snippets[] = <<<TEXT
308 add_action(
309 'wpforms_process_before',
310 array( __CLASS__, 'trackEvent' ),
311 20,
312 2
313 );
314 TEXT;
315
316 foreach ( $snippets as $snippet ) {
317 $this->assertNotFalse( strpos( $content, $snippet ) );
318 }
319 }
320
321 /**
322 * @covers \cybot\cookiebot\addons\controller\addons\official_facebook_pixel\Official_Facebook_Pixel
323 * @throws ExpectationFailedException
324 * @throws InvalidArgumentException
325 * @throws \Exception
326 */
327 public function test_official_facebook_pixel_integration_base() {
328 $content = Official_Facebook_Pixel::get_svn_file_content( 'integration/class-facebookwordpressintegrationbase.php' );
329
330 $snippet = <<<TEXT
331 add_action(
332 'wp_footer',
333 \$hook_wp_footer,
334 11
335 );
336 TEXT;
337
338 $this->assertNotFalse( strpos( $content, $snippet ) );
339 }
340 }
341