From 040b5753d3a63815117397bcf0e405780cad05a5 Mon Sep 17 00:00:00 2001 From: Mike Cotton Date: Wed, 8 Jan 2025 15:01:03 -0600 Subject: [PATCH] cookie name filter test --- .../TEC/Tickets/Commerce/CartTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/commerce_integration/TEC/Tickets/Commerce/CartTest.php b/tests/commerce_integration/TEC/Tickets/Commerce/CartTest.php index d276c0c561..5402adc3ab 100644 --- a/tests/commerce_integration/TEC/Tickets/Commerce/CartTest.php +++ b/tests/commerce_integration/TEC/Tickets/Commerce/CartTest.php @@ -173,4 +173,23 @@ public function test_cart_total_is_valid() { $assertion_msg = 'Cart->get_total() should return 0 when the cart contains only free tickets.'; $this->assertEquals( 0, $cart->get_cart_total(), $assertion_msg ); } + + /** + * @test + * + * @covers \TEC\Tickets\Commerce\Cart::get_cart_hash_cookie_name + */ + public function test_cart_hash_cookie_name() { + $original_cookie_name = Cart::get_cart_hash_cookie_name(); + $this->assertEquals( Cart::$cart_hash_cookie_name, $original_cookie_name ); + + add_filter( 'tribe_tickets_commerce_cart_hash_cookie_name', function() { + return 'different_cookie_name'; + } ); + + $different_cookie_name = Cart::get_cart_hash_cookie_name(); + $this->assertEquals( 'different_cookie_name', $different_cookie_name ); + + $this->assertNotEquals( $original_cookie_name, $different_cookie_name ); + } }