{__( 'Select the type of events to display and their order.', diff --git a/tests/e2e/.env.example b/tests/e2e/.env.example index 23c1a04..b8bfc81 100644 --- a/tests/e2e/.env.example +++ b/tests/e2e/.env.example @@ -1,5 +1,5 @@ -# Copy to .env and adjust for your local environment. -# Defaults match `npx wp-env start` out of the box. -WP_BASE_URL=http://localhost:8888 +# WP_BASE_URL is auto-discovered from the running wp-env (its assigned port +# can differ per machine/run). Only uncomment to force a specific URL. +# WP_BASE_URL=http://localhost:8888 WP_USERNAME=admin WP_PASSWORD=password diff --git a/tests/e2e/fixtures/seed-loop.php b/tests/e2e/fixtures/seed-loop.php new file mode 100644 index 0000000..1ea8a14 --- /dev/null +++ b/tests/e2e/fixtures/seed-loop.php @@ -0,0 +1,93 @@ + array( 'se-event', 'se-event-date' ), + 'post_status' => 'any', + 'numberposts' => -1, + ) +); +foreach ( $wipe as $p ) { + wp_delete_post( $p->ID, true ); +} +foreach ( get_posts( + array( + 'post_type' => 'page', + 'post_status' => 'any', + 'numberposts' => -1, + 's' => $prefix, + ) +) as $p ) { + wp_delete_post( $p->ID, true ); +} + +// Event-info block in content so the save_post cleanup hook keeps child dates. +$event_content = ''; + +foreach ( array( 10, 20, 30 ) as $i => $days ) { + $event_id = wp_insert_post( + array( + 'post_type' => 'se-event', + 'post_status' => 'publish', + 'post_title' => sprintf( '%s %s', $prefix, chr( 65 + $i ) ), + 'post_content' => $event_content, + ) + ); + + $ts = strtotime( "+{$days} days" ); + se_event_create_event_date( + $event_id, + array( + 'start_date' => $ts, + 'end_date' => $ts + 7200, + 'all_day' => false, + ) + ); +} + +// Real query-loop-events markup. offset:1 (skip the first of 3 → expect 2 +// rendered), loop-event-info set to date / h2 / Y-m-d override. +$markup = <<<'HTML' + +
No events
+ +No events
+ +