diff --git a/src/resources/images/hero-section-narrow.jpg b/src/resources/images/hero-section-narrow.jpg
new file mode 100644
index 0000000000..1491fb80ab
Binary files /dev/null and b/src/resources/images/hero-section-narrow.jpg differ
diff --git a/src/resources/images/hero-section-settings-sidebar.jpg b/src/resources/images/hero-section-settings-sidebar.jpg
new file mode 100644
index 0000000000..c9ba16facb
Binary files /dev/null and b/src/resources/images/hero-section-settings-sidebar.jpg differ
diff --git a/src/resources/images/hero-section-wide.jpg b/src/resources/images/hero-section-wide.jpg
new file mode 100644
index 0000000000..a4fa46d0d2
Binary files /dev/null and b/src/resources/images/hero-section-wide.jpg differ
diff --git a/src/resources/images/marketing/bf-promo.png b/src/resources/images/marketing/bf-promo.png
deleted file mode 100644
index fdc21940eb..0000000000
Binary files a/src/resources/images/marketing/bf-promo.png and /dev/null differ
diff --git a/src/resources/images/marketing/eoy-sale-2021.svg b/src/resources/images/marketing/eoy-sale-2021.svg
deleted file mode 100644
index ba63a4b3ee..0000000000
--- a/src/resources/images/marketing/eoy-sale-2021.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/src/resources/images/marketing/eoy-sale-promo.png b/src/resources/images/marketing/eoy-sale-promo.png
deleted file mode 100644
index 55455cb92e..0000000000
Binary files a/src/resources/images/marketing/eoy-sale-promo.png and /dev/null differ
diff --git a/src/resources/images/marketing/stellar-sale-banner-bg.svg b/src/resources/images/marketing/stellar-sale-banner-bg.svg
deleted file mode 100644
index 1090b0b04d..0000000000
--- a/src/resources/images/marketing/stellar-sale-banner-bg.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-
diff --git a/src/resources/images/mascot.png b/src/resources/images/mascot.png
index 5676c29f3b..1ba2e02c96 100644
Binary files a/src/resources/images/mascot.png and b/src/resources/images/mascot.png differ
diff --git a/src/resources/images/promos/bf-promo.png b/src/resources/images/promos/bf-promo.png
deleted file mode 100644
index b327d438c8..0000000000
Binary files a/src/resources/images/promos/bf-promo.png and /dev/null differ
diff --git a/src/resources/js/admin/conditional-content.js b/src/resources/js/admin/conditional-content.js
new file mode 100644
index 0000000000..1090d58383
--- /dev/null
+++ b/src/resources/js/admin/conditional-content.js
@@ -0,0 +1,79 @@
+/**
+ * Notice Dismiss structure
+ */
+( function( $, wp, obj ) {
+ const { tec } = window;
+
+ /**
+ * Selectors used for configuration and setup.
+ *
+ * @since 6.3.0
+ *
+ * @type {{}}
+ */
+ obj.selectors = {
+ dismissButton: '[data-tec-conditional-content-dismiss-button]',
+ dismissedContainer: '[data-tec-conditional-content-dismiss-container]',
+ };
+
+
+ /**
+ * Handles the click event on the dismiss button.
+ *
+ * @since 6.3.0
+ *
+ * @param {Event} event
+ */
+ obj.onDismissClick = ( event ) => {
+ event.preventDefault();
+
+ let $button = $( event.target );
+ if ( ! $button.is( obj.selectors.dismissButton ) ) {
+ $button = $button.parents( obj.selectors.dismissButton ).eq( 0 );
+ }
+
+ const $container = $button.parents( obj.selectors.dismissedContainer ).eq( 0 );
+
+ if ( ! $container.length ) {
+ return;
+ }
+
+ let slug = $button.data( 'tecConditionalContentDismissSlug' );
+
+ if ( ! slug ) {
+ slug = $container.data( 'tecConditionalContentDismissSlug' );
+ }
+
+ let nonce = $button.data( 'tecConditionalContentDismissNonce' );
+
+ if ( ! nonce ) {
+ nonce = $container.data( 'tecConditionalContentDismissNonce' );
+ }
+
+ if ( ! slug || ! nonce ) {
+ return;
+ }
+
+ $.ajax( ajaxurl, {
+ dataType: 'json',
+ method: 'POST',
+ data: {
+ action: 'tec_conditional_content_dismiss',
+ slug: slug,
+ nonce: nonce,
+ },
+ complete: () => {
+ $container.remove();
+ },
+ } );
+ };
+
+ $( document ).on(
+ 'click',
+ obj.selectors.dismissButton,
+ obj.onDismissClick
+ );
+
+ // Expose the object to the global scope.
+ tec.conditionalContent = obj;
+}( jQuery, window.wp, {} ) );
diff --git a/src/resources/js/dependency.js b/src/resources/js/dependency.js
index 3fb851cc16..53cf1659c8 100644
--- a/src/resources/js/dependency.js
+++ b/src/resources/js/dependency.js
@@ -35,7 +35,7 @@
};
/**
- * Replacemente for jQuery $.isNumeric that was deprecated on version 5.7 of WP.
+ * Replacement for jQuery $.isNumeric that was deprecated on version 5.7 of WP.
*
* @param {string|int} number
*
diff --git a/src/resources/js/tribe-common.js b/src/resources/js/tribe-common.js
index 1f4c0d9084..509dcd60d2 100644
--- a/src/resources/js/tribe-common.js
+++ b/src/resources/js/tribe-common.js
@@ -85,3 +85,14 @@ String.prototype.varName = function () {
* @type {object}
*/
var tribe = tribe || {}; // eslint-disable-line no-redeclare
+
+
+/**
+ * Creates a `window.tec` variable where we should start to store all the things.
+ * Eventually we will migrate all the things from `window.tribe` to `window.tec`.
+ *
+ * @since 6.3.0
+ *
+ * @type {object}
+ */
+window.tec = window.tec || {}; // eslint-disable-line no-redeclare
diff --git a/src/resources/postcss/dialog.pcss b/src/resources/postcss/dialog.pcss
index dca8d876dd..231159cda7 100644
--- a/src/resources/postcss/dialog.pcss
+++ b/src/resources/postcss/dialog.pcss
@@ -84,7 +84,8 @@ This can include modals, toasters, confirms. alerts.
/* The "close" button */
.tribe-dialog__close-button {
background: var(--tec-dialog-close-background);
- background-image: svg-inline(close-secondary);
+ /* We overwrite this for twentytwenty while we still need it. */
+ background-image: svg-inline(close-secondary) !important;
background-repeat: no-repeat;
background-size: contain;
cursor: pointer;
diff --git a/src/resources/postcss/tribe-common-admin/_licensing.pcss b/src/resources/postcss/tribe-common-admin/_licensing.pcss
new file mode 100644
index 0000000000..f1d209739d
--- /dev/null
+++ b/src/resources/postcss/tribe-common-admin/_licensing.pcss
@@ -0,0 +1,12 @@
+.stellarwp-uplink__settings-field {
+ max-width: 450px;
+ width: 100%;
+
+ @media (--viewport-medium) {
+ width: 450px;
+ }
+}
+
+.license-test-results {
+ margin-bottom: 5px;
+}
diff --git a/src/resources/postcss/tribe-common-admin/settings/_fields.pcss b/src/resources/postcss/tribe-common-admin/settings/_fields.pcss
index 82a64b748f..586ac2aa58 100644
--- a/src/resources/postcss/tribe-common-admin/settings/_fields.pcss
+++ b/src/resources/postcss/tribe-common-admin/settings/_fields.pcss
@@ -86,7 +86,7 @@
@media (--viewport-full) {
margin-bottom: var(--tec-spacer-1);
}
- }
+ }
.tec-settings-teaser-pill {
background-color: var(--tec-color-border-default);
diff --git a/src/resources/postcss/tribe-common-admin/settings/_form.pcss b/src/resources/postcss/tribe-common-admin/settings/_form.pcss
index 8598e78930..265764f4aa 100644
--- a/src/resources/postcss/tribe-common-admin/settings/_form.pcss
+++ b/src/resources/postcss/tribe-common-admin/settings/_form.pcss
@@ -46,7 +46,7 @@
background-color: var(--tec-color-background);
border: 1px solid var(--tec-admin-core-grey-10);
border-radius: var(--tec-border-radius-default);
- margin-top: var(--tec-spacer-4);
+ margin-top: var(--tec-spacer-5);
padding-top: var(--tec-spacer-7);
&.tec-settings-form__subnav-active {
@@ -72,7 +72,7 @@
border-radius: var(--tec-border-radius-default);
column-gap: var(--tec-spacer-settings-form-col-gap);
grid-template-columns: var(--tec-spacer-settings-form-width-left-col) 1fr;
- margin: var(--tec-spacer-7) 0 0 var(--tec-spacer-5);
+ margin: var(--tec-spacer-5) 0 0 var(--tec-spacer-7);
&.tec-settings-form__subnav-active {
padding-top: calc(var(--tec-spacer-9) + var(--tec-spacer-6) - 2px);
diff --git a/src/resources/postcss/tribe-common-admin/settings/_modal-sidebar.pcss b/src/resources/postcss/tribe-common-admin/settings/_modal-sidebar.pcss
index ad77584a04..45d90d5e8d 100644
--- a/src/resources/postcss/tribe-common-admin/settings/_modal-sidebar.pcss
+++ b/src/resources/postcss/tribe-common-admin/settings/_modal-sidebar.pcss
@@ -18,6 +18,7 @@
}
#tec-settings-form__sidebar-modal {
+ background: transparent;
margin: 0 0 0 auto;
max-width: var(--tec-width-sidebar);
padding: 0;
diff --git a/src/resources/postcss/tribe-common-admin/settings/_sidebar.pcss b/src/resources/postcss/tribe-common-admin/settings/_sidebar.pcss
index 921a57019e..6054bdb43d 100644
--- a/src/resources/postcss/tribe-common-admin/settings/_sidebar.pcss
+++ b/src/resources/postcss/tribe-common-admin/settings/_sidebar.pcss
@@ -10,22 +10,23 @@
.tec-settings-form__sidebar {
align-items: flex-start;
align-self: stretch;
- background-color: var(--tec-color-background);
box-sizing: border-box;
display: none;
flex-direction: column;
gap: var(--tec-spacer-3);
max-width: var(--tec-width-sidebar);
min-height: 100vh;
- padding-bottom: var(--tec-spacer-4);
width: 100%;
@media (--viewport-xlarge) {
- border: 1px solid var(--tec-color-border-default);
- border-radius: var(--tec-border-radius-default);
display: flex;
- margin: var(--tec-spacer-4) auto auto 0;
+ margin: var(--tec-spacer-5) auto auto 0;
min-height: fit-content;
+
+ > .tec-settings-form__sidebar-section {
+ margin: 0 auto auto 0;
+ border: 1px solid var(--tec-color-border-default);
+ }
}
h2,
@@ -43,38 +44,52 @@
}
img {
+ display: block;
width: 100%;
}
- .tec-settings-form__sidebar-section {
- margin: 0 var(--tec-spacer-4);
+ > .tec-settings-form__sidebar-section {
+ background-color: var(--tec-color-background);
+ border-radius: var(--tec-border-radius-default);
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ gap: var(--tec-spacer-3);
- &.tec-settings-form__sidebar-header {
- margin: 0;
+ .tec-settings-form__sidebar-section {
+ margin: 0 var(--tec-spacer-4);
- h2 {
- margin: 0 var(--tec-spacer-4);
+ &:last-child {
+ margin-bottom: var(--tec-spacer-4);
}
- img {
- border-top-left-radius: var(--tec-border-radius-default);
- border-top-right-radius: var(--tec-border-radius-default);
+ &.tec-settings-form__sidebar-header {
+ margin: 0;
+
+ h2 {
+ margin: 0 var(--tec-spacer-4);
+ }
+
+ img {
+ border-top-left-radius: var(--tec-border-radius-default);
+ border-top-right-radius: var(--tec-border-radius-default);
+ }
}
- }
- > * {
- letter-spacing: -0.28px;
- line-height: 150%;
- margin: 0;
- }
+ > * {
+ letter-spacing: -0.28px;
+ line-height: 150%;
+ margin: 0;
+ }
- a,
- p {
- font-size: var(--tec-font-size-2);
- }
+ a,
+ p {
+ font-size: var(--tec-font-size-2);
+ }
- p {
- margin: 0;
+ p {
+ margin: 0;
+ }
}
}
}
diff --git a/src/resources/postcss/tribe-common-admin/settings/_tabbed-nav.pcss b/src/resources/postcss/tribe-common-admin/settings/_tabbed-nav.pcss
index 6e1d0ac6e4..7405618d56 100644
--- a/src/resources/postcss/tribe-common-admin/settings/_tabbed-nav.pcss
+++ b/src/resources/postcss/tribe-common-admin/settings/_tabbed-nav.pcss
@@ -18,6 +18,11 @@
box-sizing: border-box;
display: block;
overflow-x: scroll;
+
+ scrollbar-width: none; /* Firefox 64 */
+ &::-webkit-scrollbar {
+ display: none;
+ }
}
@media (--viewport-full) {
@@ -145,7 +150,7 @@
border-top-right-radius: var(--tec-border-radius-default);
flex-direction: row;
margin-left: 0;
- margin-top: calc(var(--tec-spacer-7) + 1px);
+ margin-top: calc(var(--tec-spacer-7) + 5px);
overflow: hidden;
> .tec-nav__tab {
@@ -183,7 +188,7 @@
}
@media (--viewport-xlarge) {
- left: var(--tec-spacer-5);
+ left: var(--tec-spacer-7);
max-width: min(calc((100vw - 160px - var(--tec-width-sidebar)) - (var(--tec-spacer-7) * 3)), var(--tec-spacer-settings-form-width));
width: min(calc((100vw - 160px - var(--tec-width-sidebar)) - (var(--tec-spacer-7) * 3)), var(--tec-spacer-settings-form-width));
}
diff --git a/src/resources/postcss/tribe-common-admin/settings/_upsell.pcss b/src/resources/postcss/tribe-common-admin/settings/_upsell.pcss
index 8dc099fe8e..d37630622a 100644
--- a/src/resources/postcss/tribe-common-admin/settings/_upsell.pcss
+++ b/src/resources/postcss/tribe-common-admin/settings/_upsell.pcss
@@ -5,107 +5,116 @@
* This file contains styles/overrides specific to the upsell tabs.
*
* ----------------------------------------------------------------------------- */
+.tec-admin__upsell-container {
+ max-width:1000px;
+ margin: var(--tec-spacer-4) var(--tec-spacer-7) 0 var(--tec-spacer-1);
+}
-.tribe_events_page_tec-events-settings {
- #tec-settings-form .tec-settings-form__upsell {
- background-color: var(--tec-admin-core-grey-0);
- border: 1px solid var(--tec-admin-core-grey-10);
- border-radius: var(--tec-border-radius-default);
- box-sizing: border-box;
- display: flex;
- flex-direction: column-reverse;
- margin: 0;
- max-width: calc(100vw - (2 * var(--tec-spacer-7)));
- padding: var(--tec-spacer-4);
- width: 100%;
+.tec-admin__upsell-banner,
+.tribe_events_page_tec-events-settings #tec-settings-form .tec-settings-form__upsell {
+ background-color: var(--tec-admin-core-grey-0);
+ border: 1px solid var(--tec-admin-core-grey-10);
+ border-radius: var(--tec-border-radius-default);
+ box-sizing: border-box;
+ display: flex;
+ flex-direction: column-reverse;
+ margin: 0;
+ max-width: calc(100vw - (2 * var(--tec-spacer-7)));
+ padding: var(--tec-spacer-4);
+ width: 100%;
- @media (--viewport-full) {
- align-items: center;
- flex-direction: row;
- grid-column: 1 / span 2;
- max-width: 100%;
- padding: var(--tec-spacer-8);
- }
+ @media (--viewport-full) {
+ align-items: center;
+ flex-direction: row;
+ grid-column: 1 / span 2;
+ max-width: 100%;
+ padding: var(--tec-spacer-8);
+ }
- @media (--viewport-xlarge) {
- margin-right: 0;
- }
+ @media (--viewport-xlarge) {
+ margin-right: 0;
+ }
- .tec-settings-form__upsell-content {
- color: var(--tec-admin-core-grey-80);
- display: flex;
- flex-direction: column;
- max-width: 100%;
+ .tec-admin__upsell-banner-content,
+ .tec-settings-form__upsell-content {
+ color: var(--tec-admin-core-grey-80);
+ display: flex;
+ flex-direction: column;
+ max-width: 100%;
- p {
- font-size: var(--tec-font-size-7);
- line-height: var(--tec-line-height-2);
+ p {
+ font-size: var(--tec-font-size-7);
+ line-height: var(--tec-line-height-2);
- &:last-of-type {
- margin-bottom: 0;
- }
+ &:last-of-type {
+ margin-bottom: 0;
+ }
- @media (--viewport-xsmall) {
- font-size: var(--tec-font-size-5);
- }
+ @media (--viewport-xsmall) {
+ font-size: var(--tec-font-size-5);
}
}
+ }
- .tec-settings-form__upsell-header {
- display: flex;
- flex-flow: row nowrap;
- margin-bottom: var(--tec-spacer-2);
+ .tec-admin__upsell-banner-header,
+ .tec-settings-form__upsell-header {
+ display: flex;
+ flex-flow: row nowrap;
+ margin-bottom: var(--tec-spacer-2);
- .tec-settings-form__upsell-logo {
- height: var(--tec-spacer-5);
- object-fit: contain;
- vertical-align: middle;
- }
+ .tec-admin__upsell-banner-logo,
+ .tec-settings-form__upsell-logo {
+ height: var(--tec-spacer-5);
+ object-fit: contain;
+ vertical-align: middle;
+ }
- .tec-settings-form__upsell-title {
- color: var(--tec-admin-core-grey-80);
- font-size: var(--tec-font-size-7);
- font-weight: bold;
- line-height: 1;
- margin: 0 0 0 var(--tec-spacer-1);
- }
+ .tec-admin__upsell-banner-title,
+ .tec-settings-form__upsell-title {
+ color: var(--tec-admin-core-grey-80);
+ font-size: var(--tec-font-size-7);
+ font-weight: bold;
+ line-height: 1;
+ margin: 0 0 0 var(--tec-spacer-1);
}
+ }
- .tec-settings-form__upsell-image {
- align-self: center;
- height: auto;
- margin-bottom: var(--tec-spacer-5);
- max-width: 100%;
- object-fit: contain;
+ .tec-admin__upsell-banner-image,
+ .tec-settings-form__upsell-image {
+ align-self: center;
+ height: auto;
+ margin-bottom: var(--tec-spacer-5);
+ max-width: 100%;
+ object-fit: contain;
- @media (--viewport-full) {
- margin-bottom: 0;
- margin-left: var(--tec-spacer-8);
- max-width: 240px;
- }
+ @media (--viewport-full) {
+ margin-bottom: 0;
+ margin-left: var(--tec-spacer-8);
+ max-width: 240px;
}
+ }
- .tec-settings-form__upsell-btn {
- background: var(--tec-color-button-primary);
- border: 2px var(--tec-color-button-primary) solid;
- border-radius: var(--tec-border-radius-default);
- color: var(--tec-color-background);
- display: inline-block;
- font-size: var(--tec-font-size-3);
- font-weight: 500;
- margin-top: var(--tec-spacer-5);
- padding: var(--tec-spacer-3);
- text-decoration: none;
- width: fit-content;
+ .tec-admin__upsell-banner-btn,
+ .tec-settings-form__upsell-btn {
+ background: var(--tec-color-button-primary);
+ border: 2px var(--tec-color-button-primary) solid;
+ border-radius: var(--tec-border-radius-default);
+ color: var(--tec-color-background);
+ display: inline-block;
+ font-size: var(--tec-font-size-3);
+ font-weight: 500;
+ margin-top: var(--tec-spacer-5);
+ padding: var(--tec-spacer-3);
+ text-decoration: none;
+ width: fit-content;
- &:hover,
- &:active,
- &:focus {
- background: transparent;
- box-shadow: none;
- color: var(--tec-color-button-primary);
- outline: none;
- }
+ &:hover,
+ &:active,
+ &:focus {
+ background: transparent;
+ box-shadow: none;
+ color: var(--tec-color-button-primary);
+ outline: none;
}
}
}
diff --git a/tests/_support/Traits/Create_attendees.php b/tests/_support/Traits/Create_Attendees.php
similarity index 99%
rename from tests/_support/Traits/Create_attendees.php
rename to tests/_support/Traits/Create_Attendees.php
index 81bc2eb3a4..28b133f718 100644
--- a/tests/_support/Traits/Create_attendees.php
+++ b/tests/_support/Traits/Create_Attendees.php
@@ -24,8 +24,7 @@
use WC_Product_Simple;
use WP_Post;
-trait Create_attendees {
-
+trait Create_Attendees {
use RSVP_Ticket_Maker;
use TC_Ticket_Maker;
use TC_Order_Maker;
diff --git a/tests/_support/Traits/Create_events.php b/tests/_support/Traits/Create_Events.php
similarity index 99%
rename from tests/_support/Traits/Create_events.php
rename to tests/_support/Traits/Create_Events.php
index 3715758b3e..2b38da54ad 100644
--- a/tests/_support/Traits/Create_events.php
+++ b/tests/_support/Traits/Create_Events.php
@@ -6,7 +6,7 @@
use Tribe\Events\Event_Status\Classic_Editor;
use Tribe__Utils__Array as Arr;
-trait Create_events {
+trait Create_Events {
protected function generate_event( $mock_date, $overrides = [] ) {
$timezone_string = 'America/New_York';
diff --git a/tests/_support/Traits/Function_Spy.php b/tests/_support/Traits/Function_Spy.php
new file mode 100644
index 0000000000..f89b0085b4
--- /dev/null
+++ b/tests/_support/Traits/Function_Spy.php
@@ -0,0 +1,141 @@
+name;
+ }
+
+ /**
+ * Registers a call to the function.
+ *
+ * @param array $args
+ *
+ * @return void
+ */
+ public function register_call( array $args ): void {
+ $this->calls[] = $args;
+ }
+
+ /**
+ * Sets whether the function is expected to be called or not.
+ *
+ * @since TBD
+ *
+ * @return void
+ */
+ public function should_be_called(): void {
+ $this->expects_calls = true;
+ }
+
+ /**
+ * Sets whether the function is not expected to be called or not.
+ *
+ * @since TBD
+ *
+ * @return void
+ */
+ public function should_not_be_called(): void {
+ $this->expects_calls = false;
+ }
+
+ /**
+ * Returns whether the function is expected to be called or not.
+ *
+ * @return bool
+ */
+ public function expects_calls(): bool {
+ return $this->expects_calls;
+ }
+
+ /**
+ * Returns whether the function has been called or not.
+ *
+ * @return bool
+ */
+ public function was_called(): bool {
+ $this->was_verified = true;
+ return count( $this->calls ) > 0;
+ }
+
+ public function was_called_times_with( int $times, ...$args ): bool {
+ if ( count( $this->calls ) < $times ) {
+ return false;
+ }
+
+ $matching_calls = 0;
+
+ foreach ( $this->calls as $call ) {
+ $match = true;
+ foreach ( $args as $k => $arg ) {
+ if ( $arg == $call[ $k ] ) {
+ continue;
+ }
+
+ $match = false;
+ break;
+ }
+
+ $matching_calls += (int) $match;
+ }
+
+ return $matching_calls === $times;
+ }
+
+ /**
+ * Returns whether the function has been verified by a query method or not.
+ *
+ * @return bool
+ */
+ public function was_verified(): bool {
+ return $this->was_verified;
+ }
+}
diff --git a/tests/_support/Traits/Service_Locator_Mocks.php b/tests/_support/Traits/Service_Locator_Mocks.php
new file mode 100644
index 0000000000..ce78d58447
--- /dev/null
+++ b/tests/_support/Traits/Service_Locator_Mocks.php
@@ -0,0 +1,114 @@
+
+ */
+ private array $service_locator_mock_unsets = [];
+
+ /**
+ * Mocks a singleton service annd replaces it with a mock.
+ *
+ * @param string $slug The service slug.
+ * @param array $methods An array of methods and their return values.
+ * If a closure is provided, it will be called when the method is called.
+ *
+ * @return Closure A closure that will restore the original service when called.
+ */
+ protected function mock_singleton_service( $slug, array $methods ): Closure {
+ $original_service = tribe( $slug );
+ $original_class_name = get_class( $original_service );
+ $mock = $this->createPartialMock( $original_class_name, array_keys( $methods ) );
+ $mock_class_name = get_class( $mock );
+ tribe()->singleton( $slug, $mock_class_name );
+ $built_by_service_locator = tribe()->get( $slug );
+ tribe()->singleton( $slug, function () use ( $built_by_service_locator, $methods ) {
+ foreach ( $methods as $method => $return ) {
+ if ( $return instanceof Closure ) {
+ $built_by_service_locator->method( $method )->willreturncallback( $return );
+ continue;
+ }
+ $built_by_service_locator->method( $method )->willreturn( $return );
+ }
+
+ return $built_by_service_locator;
+ } );
+
+ $unsets = $this->service_locator_mock_unsets;
+ $unset = static function () use ( $slug, $original_service, &$unsets, &$unset ) {
+ tribe()->singleton( $slug, $original_service );
+ $unsets = array_values( array_diff( $unsets, [ $unset ] ) );
+ };
+
+ $this->service_locator_mock_unsets[] = $unset;
+
+ return $unset;
+ }
+
+ /**
+ * Mocks a prototype service. i.e. a service that is not bound as a singleton, and replaces it with a mock.
+ *
+ * @param string $slug The service slug.
+ * @param array $methods An array of methods and their return values.
+ * If a closure is provided, it will be called when the method is called.
+ *
+ * @return Closure A closure that will restore the original service when called.
+ */
+ protected function mock_prototype_service( $slug, array $methods ): Closure {
+ $original_service = tribe( $slug );
+ $original_class_name = get_class( $original_service );
+ $mock = $this->createPartialMock( $original_class_name, array_keys( $methods ) );
+ $mock_class_name = get_class( $mock );
+ tribe()->bind( $slug, $mock_class_name );
+ $built_by_service_locator = tribe()->get( $slug );
+ tribe()->bind( $slug, function () use ( $built_by_service_locator, $methods ) {
+ $built_by_service_locator_clone = clone $built_by_service_locator;
+ foreach ( $methods as $method => $return ) {
+ if ( $return instanceof Closure ) {
+ $built_by_service_locator_clone->method( $method )->willreturncallback( $return );
+ continue;
+ }
+ $built_by_service_locator_clone->method( $method )->willreturn( $return );
+ }
+
+ return $built_by_service_locator_clone;
+ } );
+
+ $unsets = $this->service_locator_mock_unsets;
+ $unset = static function () use ( $slug, $original_service, &$unsets, &$unset ) {
+ tribe()->bind( $slug, $original_service );
+ $unsets = array_values( array_diff( $unsets, [ $unset ] ) );
+ };
+
+ $this->service_locator_mock_unsets[] = $unset;
+
+ return $unset;
+ }
+
+ /**
+ * @after
+ */
+ public function unset_all_service_locator_mocks(): void {
+ foreach ( $this->service_locator_mock_unsets as $unset ) {
+ $unset();
+ }
+
+ $this->service_locator_mock_unsets = [];
+ }
+}
diff --git a/tests/_support/Traits/WP_Remote_Mocks.php b/tests/_support/Traits/WP_Remote_Mocks.php
new file mode 100644
index 0000000000..82e84617be
--- /dev/null
+++ b/tests/_support/Traits/WP_Remote_Mocks.php
@@ -0,0 +1,191 @@
+name = $name;
+ $this->method = strtoupper( $method );
+ $this->url = $url;
+ }
+
+ public function get_url(): string {
+ return $this->url;
+ }
+
+ public function get_http_method(): string {
+ return $this->method;
+ }
+
+ public function tear_down(): void {
+ $this->was_verified = true;
+ uopz_unset_return( $this->name );
+ }
+}
+
+/**
+ * Class WP_Request_Mocking.
+ *
+ * @since TBD
+ *
+ * @package Traits;
+ */
+trait WP_Remote_Mocks {
+ /**
+ * A map from the hash of the mock function to the calls that were made to it.
+ *
+ * @var WP_Remote_Mock_Spy[]
+ */
+ private array $wp_remote_spies = [];
+
+ /**
+ * Mocks a `wp_remote_` function based on the URL.
+ *
+ * Note this function will not throw an exception if the mock is never called.
+ *
+ * @since TBD
+ *
+ * @param string $type The type of function to mock, e.g. `post` will mock `wp_remote_post`.
+ * @param string $mock_url The URL to mock requests for; requests that do not match this will not
+ * be mocked. Requests for another URL will be passed through to the
+ * original function.
+ * @param array|callable $expected_args The set of arguments to check against the request.
+ * This does not have to be a comprehensive list of all
+ * arguments, but it should be enough to cover the ones that are
+ * relevant to the test. If the callable returns a Generator, it will
+ * be called to get the expected arguments at each step.
+ * @param mixed $mock_response The response to return for the mocked request; it can be a WP_Error
+ * to simulate an HTTP API failure. If the callable
+ * returns a Generator, it will be called to get the response at each
+ * step.
+ *
+ * @return WP_Remote_Mock_Spy The spy object that can be used to assert the calls.
+ *
+ * @throws \ReflectionException
+ */
+ protected function mock_wp_remote( string $type, string $mock_url, $expected_args, $mock_response ): WP_Remote_Mock_Spy {
+ // Extract the expected arguments' generator.
+ if (
+ is_callable( $expected_args )
+ && ( $return_type = ( new \ReflectionFunction( $expected_args ) )->getReturnType() )
+ && $return_type->getName() === Generator::class
+ ) {
+ $expected_args = $expected_args();
+ }
+
+ // Extract the mock response generator.
+ if (
+ is_callable( $mock_response )
+ && ( $return_type = ( new \ReflectionFunction( $mock_response ) )->getReturnType() )
+ && $return_type->getName() === Generator::class
+ ) {
+ $mock_response = $mock_response();
+ }
+
+ $name = in_array( $type, [ 'get', 'head', 'post' ], true ) ? 'wp_remote_' . $type : 'wp_remote_request';
+ $spy = new WP_Remote_Mock_Spy( $name, $type, $mock_url );
+
+ $mock = function ( string $url, array $args ) use ( $mock_url, $expected_args, $mock_response, &$spy ) {
+ if ( $url !== $mock_url ) {
+ return wp_remote_post( $url, $args );
+ }
+
+ $compare_args = $expected_args;
+ if ( is_callable( $expected_args ) ) {
+ $compare_args = $expected_args( $args );
+ } elseif ( $expected_args instanceof \Generator ) {
+ $compare_args = $expected_args->current();
+ $expected_args->next();
+ }
+
+ foreach ( $compare_args as $key => $value ) {
+ Assert::assertEquals( $value, $args[ $key ], 'Argument ' . $key . ' does not match.' );
+ }
+
+ $current_mock_response = $mock_response;
+ if ( is_callable( $mock_response ) ) {
+ $current_mock_response = $mock_response();
+ } elseif ( $mock_response instanceof \Generator ) {
+ $current_mock_response = $mock_response->current();
+ $mock_response->next();
+ }
+
+ $spy->register_call( $args );
+
+ return $current_mock_response;
+ };
+
+ $this->wp_remote_spies[] = $spy;
+
+ if ( in_array( $type, [ 'get', 'head', 'post' ], true ) ) {
+ $this->set_fn_return( "wp_remote_{$type}", $mock, true );
+ } else {
+ $this->set_fn_return( "wp_remote_request", $mock, true );
+ }
+
+ return $spy;
+ }
+
+ /**
+ * @after
+ */
+ public function assert_wp_remote_mocks_post_conditions(): void {
+ foreach ( $this->wp_remote_spies as $spy ) {
+ if ( ! $spy->was_verified() && $spy->expects_calls() ) {
+ if($spy->expects_calls()){
+ $this->assertTrue( $spy->was_called(),
+ sprintf(
+ "The %s mock function for [%s %s] was not called.",
+ $spy->get_name(),
+ $spy->get_http_method(),
+ $spy->get_url(),
+ )
+ );
+ } else {
+ $this->assertFalse( $spy->was_called(),
+ sprintf(
+ "The %s mock function for [%s %s] was called.",
+ $spy->get_name(),
+ $spy->get_http_method(),
+ $spy->get_url(),
+ )
+ );
+ }
+ }
+ }
+
+ $this->wp_remote_spies = [];
+ }
+}
\ No newline at end of file
diff --git a/tests/_support/Traits/WP_Send_Json_Mocks.php b/tests/_support/Traits/WP_Send_Json_Mocks.php
new file mode 100644
index 0000000000..efedcf7c51
--- /dev/null
+++ b/tests/_support/Traits/WP_Send_Json_Mocks.php
@@ -0,0 +1,164 @@
+name = $name;
+ }
+
+ public function get_pretty_arguments(): string {
+ return json_encode( $this->calls, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_HEX_QUOT | JSON_UNESCAPED_SLASHES );
+ }
+
+ public function get_pretty_calls(): array {
+ return array_map( static function ( $call ) {
+ return var_export( $call, true );
+ }, $this->calls );
+ }
+
+ public function get_calls_as_string(): string {
+ return var_export( $this->calls, true );
+ }
+}
+
+/**
+ * Class WP_Send_Json_Mocks.
+ *
+ * @since TBD
+ *
+ * @package Traits;
+ */
+trait WP_Send_Json_Mocks {
+ /**
+ * A map from the hash of the mock function to the calls that were made to it.
+ *
+ * @var WP_Send_Json_Mock_Spy[]
+ */
+ public array $wp_send_json_spies = [];
+
+ public WP_Send_Json_Mock_Spy $wp_send_json_unexpected_spy;
+
+ /**
+ * @before
+ */
+ public function set_up_wp_send_json_mocks(): void {
+ $this->wp_send_json_spies = [];
+ $this->wp_send_json_unexpected_spy = new WP_Send_Json_Mock_Spy( 'wp_send_json' );
+ $this->wp_send_json_unexpected_spy->should_not_be_called();
+ $this->wp_send_json_spies[] = $this->wp_send_json_unexpected_spy;
+ $test_case = $this;
+ $log_unexpected = static function ( $response, $status_code = null, $flags = 0 ) use ( $test_case ) {
+ $test_case->wp_send_json_unexpected_spy->register_call( [ $response, $status_code, $flags ] );
+ };
+ $this->set_fn_return( "wp_send_json", $log_unexpected, true );
+
+ $this->set_fn_return(
+ 'check_ajax_referer',
+ static function ( $action = -1, $query_arg = false, $stop = true ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
+ $nonce = '';
+ // phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
+ if ( $query_arg && isset( $_REQUEST[ $query_arg ] ) ) {
+ $nonce = $_REQUEST[ $query_arg ];
+ } elseif ( isset( $_REQUEST['_ajax_nonce'] ) ) {
+ $nonce = $_REQUEST['_ajax_nonce'];
+ } elseif ( isset( $_REQUEST['_wpnonce'] ) ) {
+ $nonce = $_REQUEST['_wpnonce'];
+ }
+ // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
+
+ $result = wp_verify_nonce( $nonce, $action );
+
+ if ( ! $result && $stop ) {
+ throw new Exception( 'check_ajax_referer failed and was called with stop = true' );
+ }
+
+ return $result;
+ },
+ true
+ );
+ }
+
+ protected function mock_wp_send_json_error( $value = null, $status_code = null, $flags = 0 ): WP_Send_Json_Mock_Spy {
+ $spy = new WP_Send_Json_Mock_Spy( 'wp_send_json_error' );
+
+ $mock = static function ( $value = null, $status_code = null, $flags = 0 ) use ( $spy ) {
+ $spy->register_call( [ $value, $status_code, $flags ] );
+ };
+
+ $this->set_fn_return( "wp_send_json_error", $mock, true );
+ $this->wp_send_json_spies[] = $spy;
+
+ return $spy;
+ }
+
+ protected function mock_wp_send_json_success(): WP_Send_Json_Mock_Spy {
+ $spy = new WP_Send_Json_Mock_Spy( 'wp_send_json_success' );
+ $mock = function ( $data = null, $status_code = null, $options = 0 ) use ( $spy ) {
+ $spy->register_call( [ $data, $status_code, $options ] );
+ };
+
+ $this->set_fn_return( "wp_send_json_success", $mock, true );
+ $this->wp_send_json_spies[] = $spy;
+
+ return $spy;
+ }
+
+ protected function reset_wp_send_json_mocks(): void {
+ $this->wp_send_json_spies = [];
+ uopz_unset_return( 'wp_send_json_error' );
+ uopz_unset_return( 'wp_send_json_success' );
+ }
+
+ /**
+ * @after
+ */
+ public function assert_wp_send_json_mocks_post_conditions(): void {
+ foreach ( $this->wp_send_json_spies as $spy ) {
+ if ( $spy->was_verified() ) {
+ continue;
+ }
+
+ if ( $spy->expects_calls() ) {
+ $this->assertTrue( $spy->was_called(),
+ sprintf(
+ "The %s mock function was never called with expected arguments:\n%s\n\nUnexpected calls:\n%s\n\nwp_send_json calls:\n%s",
+ $spy->get_name(),
+ $spy->get_pretty_arguments(),
+ implode( "\n", $spy->get_pretty_calls() ) ?: 'none',
+ implode( "\n", $this->wp_send_json_unexpected_spy->get_pretty_calls() ) ?: 'none',
+ )
+ );
+ } else {
+ $this->assertFalse( $spy->was_called(),
+ sprintf(
+ "The %s mock function was unexpectedly called with:\n%s",
+ $spy->get_name(),
+ implode( "\n", $spy->get_pretty_calls() )
+ )
+ );
+ }
+ }
+
+ $this->wp_send_json_spies = [];
+ $this->wp_send_json_unexpected_spy = new WP_Send_Json_Mock_Spy( 'wp_send_json' );
+ }
+}
diff --git a/tests/_support/Traits/With_Clock_Mock.php b/tests/_support/Traits/With_Clock_Mock.php
new file mode 100644
index 0000000000..f3a58be387
--- /dev/null
+++ b/tests/_support/Traits/With_Clock_Mock.php
@@ -0,0 +1,71 @@
+clock_mock_frozen ) {
+ return;
+ }
+
+ ClockMock::reset();
+ }
+
+ /**
+ * Using the clock mock library, set the current PHP time and date functions to a specific time.
+ *
+ * @since TBD
+ *
+ * @param \DateTimeInterface $datetime The datetime to freeze the clock to.
+ *
+ * @return void Time is frozen.
+ */
+ protected function freeze_time( \DateTimeInterface $datetime ): void {
+ $this->clock_mock_frozen = true;
+ ClockMock::freeze( $datetime );
+ }
+
+ /**
+ * Unfreeze the time.
+ *
+ * @since TBD
+ *
+ * @return void Time is unfrozen.
+ */
+ protected function unfreeze_time(): void {
+ if ( ! $this->clock_mock_frozen ) {
+ return;
+ }
+
+ $this->clock_mock_frozen = false;
+ ClockMock::reset();
+ }
+}
diff --git a/tests/_support/Traits/With_Uopz.php b/tests/_support/Traits/With_Uopz.php
index 13967728da..436c78407a 100644
--- a/tests/_support/Traits/With_Uopz.php
+++ b/tests/_support/Traits/With_Uopz.php
@@ -2,6 +2,7 @@
namespace Tribe\Tests\Traits;
+use Closure;
use PHPUnit\Framework\Assert;
trait With_Uopz {
@@ -93,14 +94,19 @@ public function unset_uopz_functions() {
* @param boolean $execute If true, and a Closure was provided as the value,
* the Closure will be executed in place of the original function.
*
- * @return void
+ * @return Closure A Closure that will unset the return value when called.
*/
- private function set_fn_return( $fn, $value, $execute = false ) {
+ private function set_fn_return( $fn, $value, $execute = false ): Closure {
if ( ! function_exists( 'uopz_set_return' ) ) {
$this->markTestSkipped( 'uopz extension is not installed' );
}
uopz_set_return( $fn, $value, $execute );
self::$uopz_set_returns[] = $fn;
+
+ return static function () use ( $fn ) {
+ uopz_unset_return( $fn );
+ self::$uopz_set_returns = array_values( array_diff( self::$uopz_set_returns, [ $fn ] ) );
+ };
}
private function set_const_value( $const, ...$args ) {
@@ -146,7 +152,7 @@ private function set_const_value( $const, ...$args ) {
Assert::assertEquals( $previous_value, constant( $class . '::' . $const ) );
};
}
- uopz_redefine( $const, ...$args );
+ uopz_redefine( $class, ...$args );
self::$uopz_redefines[] = $restore_callback;
}
@@ -204,9 +210,9 @@ public function undefine_uopz_class_fn() {
/**
* @param string $function
- * @param \Closure $handler
+ * @param Closure $handler
*/
- private function add_fn( string $function, \Closure $handler ) {
+ private function add_fn( string $function, Closure $handler ) {
if ( ! function_exists( 'uopz_add_function' ) ) {
$this->markTestSkipped( 'uopz extension is not installed' );
}
diff --git a/tests/eva_integration/Power_Automate/Triggers/AttendeesTest.php b/tests/eva_integration/Power_Automate/Triggers/AttendeesTest.php
index 12f76590df..d1c142fbcb 100644
--- a/tests/eva_integration/Power_Automate/Triggers/AttendeesTest.php
+++ b/tests/eva_integration/Power_Automate/Triggers/AttendeesTest.php
@@ -3,14 +3,14 @@
namespace Tribe\tests\eva_integration\Power_Automate\Triggers;
use TEC\Event_Automator\Power_Automate\Triggers\Attendees;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
use Tribe\Tests\Traits\With_Uopz;
class AttendeesTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Power_Automate/Triggers/CanceledEventTest.php b/tests/eva_integration/Power_Automate/Triggers/CanceledEventTest.php
index cfbd4b89b4..f5dac86c84 100644
--- a/tests/eva_integration/Power_Automate/Triggers/CanceledEventTest.php
+++ b/tests/eva_integration/Power_Automate/Triggers/CanceledEventTest.php
@@ -8,7 +8,7 @@
class CanceledEventTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
+ use Create_Events;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Power_Automate/Triggers/CheckinTest.php b/tests/eva_integration/Power_Automate/Triggers/CheckinTest.php
index 94a5501e3c..651b0ecef5 100644
--- a/tests/eva_integration/Power_Automate/Triggers/CheckinTest.php
+++ b/tests/eva_integration/Power_Automate/Triggers/CheckinTest.php
@@ -12,8 +12,8 @@
class CheckinTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Power_Automate/Triggers/NewEventTest.php b/tests/eva_integration/Power_Automate/Triggers/NewEventTest.php
index 60db47adbd..0b8c974d21 100644
--- a/tests/eva_integration/Power_Automate/Triggers/NewEventTest.php
+++ b/tests/eva_integration/Power_Automate/Triggers/NewEventTest.php
@@ -8,7 +8,7 @@
class NewEventTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
+ use Create_Events;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Power_Automate/Triggers/OrdersTest.php b/tests/eva_integration/Power_Automate/Triggers/OrdersTest.php
index 50a0317f3f..1c8c07106d 100644
--- a/tests/eva_integration/Power_Automate/Triggers/OrdersTest.php
+++ b/tests/eva_integration/Power_Automate/Triggers/OrdersTest.php
@@ -9,8 +9,8 @@
class OrdersTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Power_Automate/Triggers/RefundedOrdersTest.php b/tests/eva_integration/Power_Automate/Triggers/RefundedOrdersTest.php
index bce311a27f..97eb48e304 100644
--- a/tests/eva_integration/Power_Automate/Triggers/RefundedOrdersTest.php
+++ b/tests/eva_integration/Power_Automate/Triggers/RefundedOrdersTest.php
@@ -9,8 +9,8 @@
class RefundedOrdersTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Power_Automate/Triggers/UpdatedAttendeesTest.php b/tests/eva_integration/Power_Automate/Triggers/UpdatedAttendeesTest.php
index a6da6184d4..c503f4c515 100644
--- a/tests/eva_integration/Power_Automate/Triggers/UpdatedAttendeesTest.php
+++ b/tests/eva_integration/Power_Automate/Triggers/UpdatedAttendeesTest.php
@@ -9,8 +9,8 @@
class UpdatedAttendeesTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Power_Automate/Triggers/UpdatedEventTest.php b/tests/eva_integration/Power_Automate/Triggers/UpdatedEventTest.php
index 137422ef67..be06e9aef0 100644
--- a/tests/eva_integration/Power_Automate/Triggers/UpdatedEventTest.php
+++ b/tests/eva_integration/Power_Automate/Triggers/UpdatedEventTest.php
@@ -8,7 +8,7 @@
class UpdatedEventTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
+ use Create_Events;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Traits/Maps/AttendeeTest.php b/tests/eva_integration/Traits/Maps/AttendeeTest.php
index c814051976..34b181b27c 100644
--- a/tests/eva_integration/Traits/Maps/AttendeeTest.php
+++ b/tests/eva_integration/Traits/Maps/AttendeeTest.php
@@ -2,8 +2,8 @@
namespace Tribe\tests\eva_integration\Traits\Maps;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
use TEC\Event_Automator\Traits\Maps\Attendees;
use Tribe\Tests\Traits\With_Uopz;
use Tribe\Test\PHPUnit\Traits\With_Post_Remapping;
@@ -13,8 +13,8 @@ class AttendeeTest extends \Codeception\TestCase\WPTestCase {
use SnapshotAssertions;
use With_Post_Remapping;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
use Attendees;
diff --git a/tests/eva_integration/Traits/Maps/Commerce/EDDTest.php b/tests/eva_integration/Traits/Maps/Commerce/EDDTest.php
index dc73c94d4f..b3488630a6 100644
--- a/tests/eva_integration/Traits/Maps/Commerce/EDDTest.php
+++ b/tests/eva_integration/Traits/Maps/Commerce/EDDTest.php
@@ -2,8 +2,8 @@
namespace Tribe\tests\eva_integration\Traits\Maps\Commerce;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
use TEC\Event_Automator\Traits\Maps\Commerce\EDD;
use Tribe\Tests\Traits\With_Uopz;
use Tribe\Test\PHPUnit\Traits\With_Post_Remapping;
@@ -13,8 +13,8 @@ class EDDTest extends \Codeception\TestCase\WPTestCase {
use SnapshotAssertions;
use With_Post_Remapping;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
use EDD;
diff --git a/tests/eva_integration/Traits/Maps/Commerce/TicketsCommerceTest.php b/tests/eva_integration/Traits/Maps/Commerce/TicketsCommerceTest.php
index e9dcecc5a7..8fed75a873 100644
--- a/tests/eva_integration/Traits/Maps/Commerce/TicketsCommerceTest.php
+++ b/tests/eva_integration/Traits/Maps/Commerce/TicketsCommerceTest.php
@@ -2,8 +2,8 @@
namespace Tribe\tests\eva_integration\Traits\Maps\Commerce;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
use TEC\Event_Automator\Traits\Maps\Commerce\Tickets_Commerce;
use Tribe\Tests\Traits\With_Uopz;
use Tribe\Test\PHPUnit\Traits\With_Post_Remapping;
@@ -13,8 +13,8 @@ class TicketsCommerceTest extends \Codeception\TestCase\WPTestCase {
use SnapshotAssertions;
use With_Post_Remapping;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
use Tickets_Commerce;
diff --git a/tests/eva_integration/Traits/Maps/Commerce/WooCommerceTest.php b/tests/eva_integration/Traits/Maps/Commerce/WooCommerceTest.php
index 6617423710..ed53332e3d 100644
--- a/tests/eva_integration/Traits/Maps/Commerce/WooCommerceTest.php
+++ b/tests/eva_integration/Traits/Maps/Commerce/WooCommerceTest.php
@@ -2,8 +2,8 @@
namespace Tribe\tests\eva_integration\Traits\Maps\Commerce;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
use TEC\Event_Automator\Traits\Maps\Commerce\WooCommerce;
use Tribe\Tests\Traits\With_Uopz;
use Tribe\Test\PHPUnit\Traits\With_Post_Remapping;
@@ -13,8 +13,8 @@ class WooCommerceTest extends \Codeception\TestCase\WPTestCase {
use SnapshotAssertions;
use With_Post_Remapping;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
use WooCommerce;
diff --git a/tests/eva_integration/Traits/Maps/EventTest.php b/tests/eva_integration/Traits/Maps/EventTest.php
index 754f6a2a73..cea1ddc4e7 100644
--- a/tests/eva_integration/Traits/Maps/EventTest.php
+++ b/tests/eva_integration/Traits/Maps/EventTest.php
@@ -19,8 +19,8 @@ class EventTest extends \Codeception\TestCase\WPTestCase {
use SnapshotAssertions;
use With_Post_Remapping;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
use Event;
diff --git a/tests/eva_integration/Traits/Maps/TicketsTest.php b/tests/eva_integration/Traits/Maps/TicketsTest.php
index 0721156295..c10da57ee7 100644
--- a/tests/eva_integration/Traits/Maps/TicketsTest.php
+++ b/tests/eva_integration/Traits/Maps/TicketsTest.php
@@ -3,8 +3,8 @@
namespace Tribe\tests\eva_integration\Traits\Maps;
use tad\Codeception\SnapshotAssertions\SnapshotAssertions;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
-use TEC\Event_Automator\Tests\Traits\Create_events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
use TEC\Event_Automator\Traits\Maps\Ticket;
use Tribe\Tests\Traits\With_Uopz;
use Tribe\Test\PHPUnit\Traits\With_Post_Remapping;
@@ -13,8 +13,8 @@ class TicketsTest extends \Codeception\TestCase\WPTestCase {
use SnapshotAssertions;
use With_Post_Remapping;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
use Ticket;
diff --git a/tests/eva_integration/Zapier/Triggers/AttendeesTest.php b/tests/eva_integration/Zapier/Triggers/AttendeesTest.php
index 0ebaa35134..9bd4d71bca 100644
--- a/tests/eva_integration/Zapier/Triggers/AttendeesTest.php
+++ b/tests/eva_integration/Zapier/Triggers/AttendeesTest.php
@@ -2,15 +2,15 @@
namespace Tribe\tests\eva_integration\Zapier\Triggers;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
use TEC\Event_Automator\Zapier\Triggers\Attendees;
use Tribe\Tests\Traits\With_Uopz;
class AttendeesTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Zapier/Triggers/CanceledEventTest.php b/tests/eva_integration/Zapier/Triggers/CanceledEventTest.php
index 805a273679..83361cbbba 100644
--- a/tests/eva_integration/Zapier/Triggers/CanceledEventTest.php
+++ b/tests/eva_integration/Zapier/Triggers/CanceledEventTest.php
@@ -2,13 +2,13 @@
namespace Tribe\tests\eva_integration\Zapier\Triggers;
-use TEC\Event_Automator\Tests\Traits\Create_events;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
use TEC\Event_Automator\Zapier\Triggers\Canceled_Events;
use Tribe\Tests\Traits\With_Uopz;
class CanceledEventTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
+ use Create_Events;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Zapier/Triggers/CheckinTest.php b/tests/eva_integration/Zapier/Triggers/CheckinTest.php
index f5a2c46dc0..eacf4b3553 100644
--- a/tests/eva_integration/Zapier/Triggers/CheckinTest.php
+++ b/tests/eva_integration/Zapier/Triggers/CheckinTest.php
@@ -2,8 +2,8 @@
namespace Tribe\tests\eva_integration\Zapier\Triggers;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
use TEC\Event_Automator\Zapier\Triggers\Checkin;
use Tribe\Tests\Traits\With_Uopz;
use TEC\Tickets\Commerce\Module;
@@ -12,8 +12,8 @@
class CheckinTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Zapier/Triggers/NewEventTest.php b/tests/eva_integration/Zapier/Triggers/NewEventTest.php
index 7a25c4ffa2..8175682187 100644
--- a/tests/eva_integration/Zapier/Triggers/NewEventTest.php
+++ b/tests/eva_integration/Zapier/Triggers/NewEventTest.php
@@ -2,13 +2,13 @@
namespace Tribe\tests\eva_integration\Zapier\Triggers;
-use TEC\Event_Automator\Tests\Traits\Create_events;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
use TEC\Event_Automator\Zapier\Triggers\New_Events;
use Tribe\Tests\Traits\With_Uopz;
class NewEventTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
+ use Create_Events;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Zapier/Triggers/OrdersTest.php b/tests/eva_integration/Zapier/Triggers/OrdersTest.php
index a9ed552209..f47733a406 100644
--- a/tests/eva_integration/Zapier/Triggers/OrdersTest.php
+++ b/tests/eva_integration/Zapier/Triggers/OrdersTest.php
@@ -2,15 +2,15 @@
namespace Tribe\tests\eva_integration\Zapier\Triggers;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
use TEC\Event_Automator\Zapier\Triggers\Orders;
use Tribe\Tests\Traits\With_Uopz;
class OrdersTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Zapier/Triggers/RefundedOrdersTest.php b/tests/eva_integration/Zapier/Triggers/RefundedOrdersTest.php
index 3f284c03fc..a3279bc6c0 100644
--- a/tests/eva_integration/Zapier/Triggers/RefundedOrdersTest.php
+++ b/tests/eva_integration/Zapier/Triggers/RefundedOrdersTest.php
@@ -2,15 +2,15 @@
namespace Tribe\tests\eva_integration\Zapier\Triggers;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
use TEC\Event_Automator\Zapier\Triggers\Refunded_Orders;
use Tribe\Tests\Traits\With_Uopz;
class RefundedOrdersTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Zapier/Triggers/UpdatedAttendeesTest.php b/tests/eva_integration/Zapier/Triggers/UpdatedAttendeesTest.php
index 18b9b45954..901df6381a 100644
--- a/tests/eva_integration/Zapier/Triggers/UpdatedAttendeesTest.php
+++ b/tests/eva_integration/Zapier/Triggers/UpdatedAttendeesTest.php
@@ -2,15 +2,15 @@
namespace Tribe\tests\eva_integration\Zapier\Triggers;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
use TEC\Event_Automator\Zapier\Triggers\Updated_Attendees;
use Tribe\Tests\Traits\With_Uopz;
class UpdatedAttendeesTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
use With_Uopz;
public function setUp() {
diff --git a/tests/eva_integration/Zapier/Triggers/UpdatedEventTest.php b/tests/eva_integration/Zapier/Triggers/UpdatedEventTest.php
index 87e7850d2b..36c197e507 100644
--- a/tests/eva_integration/Zapier/Triggers/UpdatedEventTest.php
+++ b/tests/eva_integration/Zapier/Triggers/UpdatedEventTest.php
@@ -2,13 +2,13 @@
namespace Tribe\tests\eva_integration\Zapier\Triggers;
-use TEC\Event_Automator\Tests\Traits\Create_events;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
use TEC\Event_Automator\Zapier\Triggers\Updated_Events;
use Tribe\Tests\Traits\With_Uopz;
class UpdatedEventTest extends \Codeception\TestCase\WPTestCase {
- use Create_events;
+ use Create_Events;
use With_Uopz;
public function setUp() {
diff --git a/tests/integration/Tribe/PUE/Checker_Test.php b/tests/integration/Tribe/PUE/Checker_Test.php
index e8aab9789a..9e4aaffe06 100644
--- a/tests/integration/Tribe/PUE/Checker_Test.php
+++ b/tests/integration/Tribe/PUE/Checker_Test.php
@@ -4,6 +4,9 @@
use TEC\Common\Tests\Licensing\PUE_Service_Mock;
use Tribe__PUE__Checker as PUE_Checker;
+use Tribe__Main;
+use TEC\Common\StellarWP\Uplink\Register;
+use function TEC\Common\StellarWP\Uplink\get_resource;
class Checker_Test extends \Codeception\TestCase\WPTestCase {
/**
@@ -104,6 +107,28 @@ public function should_update_license_key_if_replacement_key_provided_and_key_pr
$this->assertEquals( $replacement_key, $pue_instance->get_key() );
}
+ /**
+ * @test
+ */
+ public function it_should_check_uplink_before_pue() {
+ Register::plugin(
+ 'test-plugin',
+ 'Test Plugin',
+ '1.0.0',
+ __DIR__,
+ tribe( Tribe__Main::class )
+ );
+
+ $key = 'license-key-for-test-plugin';
+
+ $resource = get_resource( 'test-plugin' );
+ $resource->set_license_key( $key, 'any' );
+
+ $pue_instance = new PUE_Checker( 'deprecated', 'test-plugin', [], 'test-plugin/test-plugin.php' );
+
+ $this->assertEquals( $key, $pue_instance->get_key() );
+ }
+
public function test_replacemnt_key_update_in_multisite_context(): void {
}
diff --git a/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/AttendeesCest.php b/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/AttendeesCest.php
index 6509102f3e..1524caddaf 100644
--- a/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/AttendeesCest.php
+++ b/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/AttendeesCest.php
@@ -5,14 +5,14 @@
use TEC\Event_Automator\Tests\Testcases\REST\V1\BaseRestETPowerAutomateCest;
use Restv1_etTester;
use tad\Codeception\SnapshotAssertions\SnapshotAssertions;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
class AttendeesCest extends BaseRestETPowerAutomateCest {
use SnapshotAssertions;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
/**
* @inheritdoc
diff --git a/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/CheckinCest.php b/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/CheckinCest.php
index 75ddebfb96..66cd74b21d 100644
--- a/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/CheckinCest.php
+++ b/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/CheckinCest.php
@@ -11,8 +11,8 @@
class CheckinCest extends BaseRestETPowerAutomateCest {
use SnapshotAssertions;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
/**
* @test
diff --git a/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/OrdersCest.php b/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/OrdersCest.php
index 20d8e35f74..0a759ad2bc 100644
--- a/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/OrdersCest.php
+++ b/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/OrdersCest.php
@@ -5,14 +5,14 @@
use TEC\Event_Automator\Tests\Testcases\REST\V1\BaseRestETPowerAutomateCest;
use Restv1_etTester;
use tad\Codeception\SnapshotAssertions\SnapshotAssertions;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
class OrdersCest extends BaseRestETPowerAutomateCest {
use SnapshotAssertions;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
/**
* @test
diff --git a/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/RefundedOrdersCest.php b/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/RefundedOrdersCest.php
index 158bc7e8b9..313663883d 100644
--- a/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/RefundedOrdersCest.php
+++ b/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/RefundedOrdersCest.php
@@ -5,14 +5,14 @@
use TEC\Event_Automator\Tests\Testcases\REST\V1\BaseRestETPowerAutomateCest;
use Restv1_etTester;
use tad\Codeception\SnapshotAssertions\SnapshotAssertions;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
class RefundedOrdersCest extends BaseRestETPowerAutomateCest {
use SnapshotAssertions;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
/**
* @inheritdoc
diff --git a/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/UpdatedAttendeeCest.php b/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/UpdatedAttendeeCest.php
index 173851143d..fb0d152738 100644
--- a/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/UpdatedAttendeeCest.php
+++ b/tests/restv1_et/Event_Automator/Power_Automate/REST/V1/Endpoints/Queue/UpdatedAttendeeCest.php
@@ -11,8 +11,8 @@
class UpdatedAttendeeCest extends BaseRestETPowerAutomateCest {
use SnapshotAssertions;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
/**
* @test
diff --git a/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/Actions/FindTicketsCest.php b/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/Actions/FindTicketsCest.php
index 3bebb40eda..317739ae28 100644
--- a/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/Actions/FindTicketsCest.php
+++ b/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/Actions/FindTicketsCest.php
@@ -17,8 +17,8 @@
class FindTicketsCest extends BaseRestETCest {
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
/*
* Attendee meta values.
diff --git a/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/AttendeeCest.php b/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/AttendeeCest.php
index 1f70b5fe5a..3be124b4e2 100644
--- a/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/AttendeeCest.php
+++ b/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/AttendeeCest.php
@@ -5,14 +5,14 @@
use TEC\Event_Automator\Tests\Testcases\REST\V1\BaseRestETCest;
use Restv1_etTester;
use tad\Codeception\SnapshotAssertions\SnapshotAssertions;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
class AttendeeCest extends BaseRestETCest {
use SnapshotAssertions;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
/**
* @inheritdoc
diff --git a/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/CheckinCest.php b/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/CheckinCest.php
index 6bee760d16..5259491b1c 100644
--- a/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/CheckinCest.php
+++ b/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/CheckinCest.php
@@ -5,14 +5,14 @@
use TEC\Event_Automator\Tests\Testcases\REST\V1\BaseRestETCest;
use Restv1_etTester;
use tad\Codeception\SnapshotAssertions\SnapshotAssertions;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
class CheckinCest extends BaseRestETCest {
use SnapshotAssertions;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
/**
* @inheritdoc
diff --git a/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/OrdersCest.php b/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/OrdersCest.php
index 4ac1b2b572..b45309f0c0 100644
--- a/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/OrdersCest.php
+++ b/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/OrdersCest.php
@@ -5,14 +5,14 @@
use TEC\Event_Automator\Tests\Testcases\REST\V1\BaseRestETCest;
use Restv1_etTester;
use tad\Codeception\SnapshotAssertions\SnapshotAssertions;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
class OrdersCest extends BaseRestETCest {
use SnapshotAssertions;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
/**
* @inheritdoc
diff --git a/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/RefundedOrdersCest.php b/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/RefundedOrdersCest.php
index 8b847a082e..b2693f3b1d 100644
--- a/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/RefundedOrdersCest.php
+++ b/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/RefundedOrdersCest.php
@@ -5,14 +5,14 @@
use TEC\Event_Automator\Tests\Testcases\REST\V1\BaseRestETCest;
use Restv1_etTester;
use tad\Codeception\SnapshotAssertions\SnapshotAssertions;
-use TEC\Event_Automator\Tests\Traits\Create_events;
-use TEC\Event_Automator\Tests\Traits\Create_attendees;
+use TEC\Event_Automator\Tests\Traits\Create_Events;
+use TEC\Event_Automator\Tests\Traits\Create_Attendees;
class RefundedOrdersCest extends BaseRestETCest {
use SnapshotAssertions;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
/**
* @inheritdoc
diff --git a/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/UpdatedAttendeeCest.php b/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/UpdatedAttendeeCest.php
index b1127c2783..51c38db71a 100644
--- a/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/UpdatedAttendeeCest.php
+++ b/tests/restv1_et/Event_Automator/Zapier/REST/V1/Endpoints/UpdatedAttendeeCest.php
@@ -11,8 +11,8 @@
class UpdatedAttendeeCest extends BaseRestETCest {
use SnapshotAssertions;
- use Create_events;
- use Create_attendees;
+ use Create_Events;
+ use Create_Attendees;
/**
* @inheritdoc
diff --git a/tests/snapshots/Views/Admin_Views/Stellar_SnapshotTest.php b/tests/snapshots/Views/Admin_Views/Stellar_SnapshotTest.php
deleted file mode 100644
index 19b1e4409a..0000000000
--- a/tests/snapshots/Views/Admin_Views/Stellar_SnapshotTest.php
+++ /dev/null
@@ -1,66 +0,0 @@
-set_class_fn_return( Dates::class, 'build_date_object', static function ( $input ) use ( $year ) {
- return $input === 'now' ?
- new \DateTime( "2022-07-30 19:23:23" )
- : new \DateTime( $input );
- }, true );
-
- // Mock a premium plugin installed.
- $this->set_class_fn_return( Tribe__Dependency::class, 'has_active_premium_plugin', true );
-
- $notice = tribe( Stellar_Sale::class );
-
- $this->assertMatchesHtmlSnapshot( $notice->display_notice() );
- }
-
-
- /**
- * @test
- */
- public function should_render_free() {
- // Ensure we're on a good screen.
- set_current_screen( 'tribe_events_page_tribe-common' );
-
- // Mock the `now` date to be this year on November 21st.
- $year = date( 'Y' );
- $this->set_class_fn_return( Dates::class, 'build_date_object', static function ( $input ) use ( $year ) {
- return $input === 'now' ?
- new \DateTime( "2022-07-30 19:23:23" )
- : new \DateTime( $input );
- }, true );
-
- // Mock a premium plugin installed.
- $this->set_class_fn_return( Tribe__Dependency::class, 'has_active_premium_plugin', false );
-
- $notice = tribe( Stellar_Sale::class );
-
- $this->assertMatchesHtmlSnapshot( $notice->display_notice() );
- }
-}
diff --git a/tests/snapshots/__snapshots__/BaseSnapshotTest__should_correctly_test_a_string_snapshot__0.snapshot.txt b/tests/snapshots/__snapshots__/BaseSnapshotTest__should_correctly_test_a_string_snapshot__0.snapshot.txt
deleted file mode 100644
index 1f8f6fdafa..0000000000
--- a/tests/snapshots/__snapshots__/BaseSnapshotTest__should_correctly_test_a_string_snapshot__0.snapshot.txt
+++ /dev/null
@@ -1 +0,0 @@
-test the date function can be mocked: 2019-12-31 00:00:00
\ No newline at end of file
diff --git a/tests/wpunit/Common/Libraries/Uplink_Controller_Test.php b/tests/wpunit/Common/Libraries/Uplink_Controller_Test.php
new file mode 100644
index 0000000000..ee036b1125
--- /dev/null
+++ b/tests/wpunit/Common/Libraries/Uplink_Controller_Test.php
@@ -0,0 +1,120 @@
+controller = tribe( Uplink_Controller::class );
+ $this->controller->register_uplink();
+ $this->register_plugin();
+ }
+
+ public function register_plugin() {
+ // Register the test plugin
+ Register::plugin(
+ 'common-test-slug',
+ 'common-test',
+ '1.0.0',
+ __DIR__,
+ tribe( Tribe__Main::class )
+ );
+ }
+
+ /**
+ * @test
+ */
+ public function it_should_setup_license_fields() {
+ // Retrieve the collection and the specific resource
+ $collection = Config::get_container()->get( Collection::class );
+ $slug = 'common-test-slug';
+ $resource = $collection->get( $slug );
+
+ // Update the license key to a known value
+ $option_name = $resource->get_license_object()->get_key_option_name();
+ $license_key = 'license_key' . $slug;
+ update_option( $option_name, $license_key );
+
+ // Assert the license key was updated correctly
+ $option_value = get_option( $option_name );
+ $this->assertEquals( $option_value, $license_key );
+
+ // Mock the wp_create_nonce function
+ $this->set_fn_return( 'wp_create_nonce', '123456789', false );
+
+ // Initialize fields array
+ $fields = [
+ 'tribe-form-content-start' => [],
+ ];
+
+ // Register license fields and assert the HTML snapshot
+ $license_fields = $this->controller->register_license_fields( $fields );
+
+ $html = $license_fields['stellarwp-uplink_common-test-slug']['html'];
+ $html = str_replace( dirname( __DIR__, 5 ), '{__DIR__}', $html );
+
+ $this->assertMatchesHtmlSnapshot( $html );
+ }
+
+ /**
+ * @test
+ */
+ public function it_should_add_actions_on_do_register_and_unregister() {
+ $this->controller->do_register();
+
+ // Assert actions were added
+ $this->assertNotFalse( has_action( 'init', [ $this->controller, 'register_uplink' ] ) );
+ $this->assertNotFalse( has_filter( 'tribe_license_fields', [ $this->controller, 'register_license_fields' ] ) );
+
+ $this->controller->unregister(); // Then remove them
+
+ // Assert actions were removed
+ $this->assertFalse( has_action( 'init', [ $this->controller, 'register_uplink' ] ) );
+ $this->assertFalse( has_filter( 'tribe_license_fields', [ $this->controller, 'register_license_fields' ] ) );
+ }
+
+ /**
+ * @test
+ */
+ public function it_should_handle_unregister_before_register() {
+ $this->controller->unregister(); // Call unregister before register
+
+ // Assert actions were not added
+ $this->assertFalse( has_action( 'init', [ $this->controller, 'register_uplink' ] ) );
+ $this->assertFalse( has_filter( 'tribe_license_fields', [ $this->controller, 'register_license_fields' ] ) );
+ }
+
+ /**
+ * @test
+ */
+ public function it_should_modify_fields_with_filter() {
+ $fields = [
+ 'tribe-form-content-start' => [],
+ ];
+
+ // Apply the filter
+ $modified_fields = apply_filters( 'tribe_license_fields', $fields );
+
+ // Assert that the filter modified the fields array
+ $this->assertNotEmpty( $modified_fields );
+ $this->assertArrayHasKey( 'stellarwp-uplink_common-test-slug-heading', $modified_fields );
+ $this->assertArrayHasKey( 'stellarwp-uplink_common-test-slug', $modified_fields );
+ }
+}
diff --git a/tests/wpunit/Common/Libraries/__snapshots__/Controller_Test__it_should_setup_license_fields__0.snapshot.html b/tests/wpunit/Common/Libraries/__snapshots__/Controller_Test__it_should_setup_license_fields__0.snapshot.html
new file mode 100644
index 0000000000..c19d8092de
--- /dev/null
+++ b/tests/wpunit/Common/Libraries/__snapshots__/Controller_Test__it_should_setup_license_fields__0.snapshot.html
@@ -0,0 +1,26 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/wpunit/Tribe/Notices/Black_FridayTest.php b/tests/wpunit/Tribe/Notices/Black_FridayTest.php
deleted file mode 100644
index 09fd97bb6b..0000000000
--- a/tests/wpunit/Tribe/Notices/Black_FridayTest.php
+++ /dev/null
@@ -1,168 +0,0 @@
-set_const_value( 'TRIBE_HIDE_UPSELL', true );
- // Ensure we're on a good date.
- add_filter(
- 'tribe_black-friday_notice_start_date',
- function ( $date ) {
- // Set the start date to the past.
- return Dates::build_date_object( '-7 days', 'UTC' );
- }
- );
-
- add_filter(
- 'tribe_black-friday_notice_end_date',
- function ( $date ) {
- // Set the end date to the future.
- return Dates::build_date_object( '+7 days', 'UTC' );
- }
- );
-
- // Ensure we're on a good screen.
- set_current_screen( 'tribe_events_page_tribe-common' );
-
- $notice = tribe( Tribe\Admin\Notice\Marketing\Black_Friday::class );
-
- $this->assertFalse( $notice->should_display() );
- }
-
- /**
- * Test ! should_display() when on wrong screen.
- * Note this test assumes we have not set the constant in our testing environment.
- *
- * @test
- */
- public function should_not_display_when_wrong_screen() {
- // Ensure we're on a good date.
- add_filter(
- 'tribe_black-friday_notice_start_date',
- function ( $date ) {
- // Set the start date to the past.
- return Dates::build_date_object( '-7 days', 'UTC' );
- }
- );
-
- add_filter(
- 'tribe_black-friday_notice_end_date',
- function ( $date ) {
- // Set the end date to the future.
- return Dates::build_date_object( '+7 days', 'UTC' );
- }
- );
-
- // Ensure we're on the WRONG screen.
- set_current_screen( 'edit-post' );
-
- $notice = tribe( Tribe\Admin\Notice\Marketing\Black_Friday::class );
-
- $this->assertFalse( $notice->should_display() );
- }
-
- /**
- * Test ! should_display() when date passed.
- * Note this test assumes we have not set the constant in our testing environment.
- *
- * @test
- */
- public function should_not_display_when_past() {
- add_filter(
- 'tribe_black-friday_notice_start_date',
- function ( $date ) {
- // Set the start date to the past.
- return Dates::build_date_object( '-7 days', 'UTC' );
- }, 200
- );
-
- add_filter(
- 'tribe_black-friday_notice_end_date',
- function ( $date ) {
- // Set the end date to the past.
- return Dates::build_date_object( '-5 days', 'UTC' );
- }, 200
- );
-
- // Ensure we're on a good screen.
- set_current_screen( 'tribe_events_page_tribe-common' );
-
- $notice = tribe( Tribe\Admin\Notice\Marketing\Black_Friday::class );
-
- $this->assertFalse( $notice->should_display() );
- }
-
- /**
- * Test ! should_display() when date in future.
- * Note this test assumes we have not set the constant in our testing environment.
- *
- * @test
- */
- public function should_not_display_when_in_future() {
- add_filter(
- 'tribe_black-friday_notice_start_date',
- function ( $date ) {
- // Set the start date to the future.
- return Dates::build_date_object( '+5 days', 'UTC' );
- }, 200
- );
-
- add_filter(
- 'tribe_black-friday_notice_end_date',
- function ( $date ) {
- // Set the end date to the future.
- return Dates::build_date_object( '+7 days', 'UTC' );
- }, 200
- );
-
- // Ensure we're on a good screen.
- set_current_screen( 'tribe_events_page_tribe-common' );
-
- $notice = tribe( Tribe\Admin\Notice\Marketing\Black_Friday::class );
-
- $this->assertFalse( $notice->should_display() );
- }
-
- /**
- * Test should_display() when the stars align (all conditions true).
- * Note this test assumes we have not set the constant in our testing environment.
- *
- * @test
- */
- public function should_display_when_stars_align() {
- add_filter(
- 'tribe_black-friday_notice_start_date',
- function ( $date ) {
- // Set the start date to the past.
- return Dates::build_date_object( '-7 days', 'UTC' );
- }, 200
- );
-
- add_filter(
- 'tribe_black-friday_notice_end_date',
- function ( $date ) {
- // Set the end date to the future.
- return Dates::build_date_object( '+7 days', 'UTC' );
- }, 200
- );
-
- // Ensure we're on a good screen.
- set_current_screen( 'tribe_events_page_tribe-common' );
-
- $notice = tribe( Tribe\Admin\Notice\Marketing\Black_Friday::class );
-
- codecept_debug( $notice );
-
- $this->assertTrue( $notice->should_display() );
- }
-}
diff --git a/tests/wpunit/Tribe/Notices/Stellar_SaleTest.php b/tests/wpunit/Tribe/Notices/Stellar_SaleTest.php
deleted file mode 100644
index 3529300702..0000000000
--- a/tests/wpunit/Tribe/Notices/Stellar_SaleTest.php
+++ /dev/null
@@ -1,152 +0,0 @@
-assertFalse( $notice->should_display() );
-
- // So we don't muck up later tests.
- remove_all_filters( 'tribe_stellar-sale-2024_notice_start_date' );
- uopz_undefine( 'TRIBE_HIDE_UPSELL' );
- }
-
- /**
- * Test ! should_display() when on wrong screen.
- * Note this test assumes we have not set the constant in our testing environment.
- *
- * @test
- */
- public function should_not_display_when_wrong_screen() {
- // Ensure we're on a good date.
- add_filter(
- 'tribe_stellar-sale-2024_notice_start_date',
- function( $date ) {
- // Set the start date to the past.
- return Dates::build_date_object( '-7 days', 'UTC' );
- }
- );
-
- add_filter(
- 'tribe_stellar-sale-2024_notice_end_date',
- function( $date ) {
- // Set the end date to the future.
- return Dates::build_date_object( '+7 days', 'UTC' );
- }
- );
-
- // Ensure we're on the WRONG screen.
- set_current_screen( 'edit-post' );
-
- $notice = tribe( Tribe\Admin\Notice\Marketing\Stellar_Sale::class );
-
- $this->assertFalse( $notice->should_display() );
-
- // So we don't muck up later tests.
- remove_all_filters( 'tribe_stellar-sale-2024_notice_start_date' );
- }
-
- /**
- * Test ! should_display() when date passed.
- * Note this test assumes we have not set the constant in our testing environment.
- *
- * @test
- */
- public function should_not_display_when_past() {
- // Ensure we're on a good screen.
- set_current_screen( 'tribe_events_page_tribe-common' );
-
- // Mock the `now` date to be this year, in the past of the notice display date.
- $year = date( 'Y' );
- $this->set_class_fn_return( Dates::class, 'build_date_object', static function ( $input ) use ( $year ) {
- return $input === 'now' ?
- new DateTime( "$year-02-23 09:23:23" )
- : new DateTime( $input );
- }, true );
-
- $notice = tribe( Tribe\Admin\Notice\Marketing\Stellar_Sale::class );
-
- $this->assertFalse( $notice->should_display() );
- }
-
- /**
- * Test ! should_display() when date in future.
- * Note this test assumes we have not set the constant in our testing environment.
- *
- * @test
- */
- public function should_not_display_when_in_future() {
- // Ensure we're on a good screen.
- set_current_screen( 'tribe_events_page_tribe-common' );
-
- // Mock the `now` date to be this year, in the future of the notice display date.
- $year = date( 'Y' );
- $this->set_class_fn_return( Dates::class, 'build_date_object', static function ( $input ) use ( $year ) {
- return $input === 'now' ?
- new DateTime( "$year-12-10 09:23:23" )
- : new DateTime( $input );
- }, true );
-
- $notice = tribe( Tribe\Admin\Notice\Marketing\Stellar_Sale::class );
-
- $this->assertFalse( $notice->should_display() );
- }
-
- /**
- * Test should_display() when the stars align (all conditions true).
- * Note this test assumes we have not set the constant in our testing environment.
- *
- * @test
- */
- public function should_display_when_stars_align() {
- // Ensure we're on a good screen.
- set_current_screen( 'tribe_events_page_tribe-common' );
-
- // Mock the `now` date to be this year on November 21st.
- $year = date( 'Y' );
- $this->set_class_fn_return( Dates::class, 'build_date_object', static function ( $input ) use ( $year ) {
- return $input === 'now' ?
- new DateTime( '2024-07-26 19:23:23' )
- : new DateTime( $input );
- }, true );
-
- $notice = tribe( Tribe\Admin\Notice\Marketing\Stellar_Sale::class );
-
- $this->assertTrue( $notice->should_display() );
- }
-}
diff --git a/tribe-common.php b/tribe-common.php
index 4788532bb9..d15259789e 100644
--- a/tribe-common.php
+++ b/tribe-common.php
@@ -2,7 +2,7 @@
/**
* Plugin Name: Tribe Common
* Description: An event settings framework for managing shared options.
- * Version: 6.1.0
+ * Version: 6.3.0
* Requires at least: 6.3
* Requires PHP: 7.4
* Author: The Events Calendar