-
Notifications
You must be signed in to change notification settings - Fork 6
Add test coverage for bug fixes #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
BUG-1: Timezone 8-hours-ahead issue - Add run_timestamp to schedule data for timezone-safe comparisons instead of using strtotime() on already converted time strings BUG-2: Weekly Guide channel switcher - Remove inline onchange handler, let JavaScript handle URL building properly with URL API BUG-3: Settings checkbox won't disable - Add sanitization callback to explicitly handle unchecked checkboxes BUG-4: Cablecast Home channel buttons - Add JavaScript click handlers and URL parameter support for channel tabs BUG-5: Categories grid breaks with long names - Add CSS overflow handling with word-break and hyphens BUG-6: Cablecast Home browse links - Fix undefined $shows_archive variable 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Test run_timestamp property in cablecast_get_schedules() - Test cablecast_sanitize_options for checkbox handling - Test cablecast_home shortcode registration and output - Test channel tabs with data attributes for JS - Test weekly guide channel switcher has no inline handler 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Load settings.php conditionally in tests (not loaded outside admin) - Fix run_timestamp tests to insert UTC dates for proper query matching - Use gmdate() for UTC and current_time() for site timezone 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Clarify schedule mode descriptions (remaining=rest of today, next=24hrs) - Document date vs event_date in orderby option - Add additional calendar view options (listDay, dayGridWeek, dayGridDay) - Explain Cablecast Home page template customization - Add "Enable Templates" checkbox to settings UI (was code-only) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add "Cablecast: Visibility" meta box to Show edit screen - Add "Hide from listings" checkbox to Producer, Series, Category term edit screens - Sync cablecast_show_cg_exempt from Cablecast API (auto-hides CG exempt shows) - Add cablecast_is_hidden() and cablecast_is_term_hidden() helper functions - Filter hidden content from shortcodes: shows, producers, series, categories - Filter hidden shows from schedule shortcodes: schedule, now_playing, weekly_guide - Add pre_get_posts filter to exclude hidden shows from archives - Add "Hidden" admin column to Shows list with icon indicator - Update README with Hide from Listings documentation - Update brians-feedback.md with feature analysis and implementation status Resolves: "Exclude by ID/slug" and "CG Exempt master setting" feature requests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Enable editing of Producers/Series taxonomies by setting proper capabilities (was disabled with empty edit_terms capability) - Add Hide from Listings checkbox to Tags (post_tag) taxonomy - Update cablecast_is_hidden() to check tag visibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive test coverage for bug fixes that were previously merged into master. The tests verify timezone handling, checkbox sanitization, shortcode registration, and JavaScript integration points.
Key changes:
- Tests for
run_timestampproperty in schedule data (timezone fix verification) - Tests for checkbox sanitization in settings (ensures unchecked checkboxes properly save as false)
- Tests for
cablecast_homeshortcode functionality including channel tabs and data attributes
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ShortcodesTest.php | Adds 24 new test methods covering schedule timestamps, settings sanitization, and home shortcode functionality |
| includes/sync.php | Syncs CG exempt flag from Cablecast API to post meta |
| includes/shortcodes.php | Adds hidden content filtering across all listing shortcodes |
| includes/shortcode-docs.php | Clarifies documentation for mode, orderby, view options, and template customization |
| includes/settings.php | Adds enable_templates checkbox to settings |
| includes/content.php | Implements comprehensive content visibility system with meta boxes, taxonomy fields, and admin UI |
| brians-feedback.md | Documents tester feedback analysis and implementation status |
| README.md | Documents the hiding content feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Call cablecast_get_schedules - use current_time for site timezone | ||
| $schedules = cablecast_get_schedules($channel_id, current_time('Y-m-d'), date('Y-m-d', strtotime('+1 day'))); |
Copilot
AI
Jan 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The start and end dates use different timezone contexts - current_time() respects WordPress timezone while date() uses server timezone. This inconsistency could cause the date range to be incorrect. Use current_time('Y-m-d', strtotime('+1 day')) for the end date or use DateTime objects with explicit timezone for both dates.
| // Call cablecast_get_schedules - use current_time for site timezone | |
| $schedules = cablecast_get_schedules($channel_id, current_time('Y-m-d'), date('Y-m-d', strtotime('+1 day'))); | |
| // Call cablecast_get_schedules - use WordPress timezone for both dates | |
| $timezone = wp_timezone(); | |
| $end_date = ( new DateTime( 'now', $timezone ) )->modify( '+1 day' )->format( 'Y-m-d' ); | |
| $schedules = cablecast_get_schedules( $channel_id, current_time( 'Y-m-d' ), $end_date ); |
| ]); | ||
|
|
||
| $channel_id = get_post_meta($this->channel_post_id, 'cablecast_channel_id', true); | ||
| $schedules = cablecast_get_schedules($channel_id, current_time('Y-m-d'), date('Y-m-d', strtotime('+1 day'))); |
Copilot
AI
Jan 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same timezone inconsistency issue as in the previous test. The start date uses WordPress site timezone via current_time() while the end date uses server timezone via date(). Both should use the same timezone context.
| $schedules = cablecast_get_schedules($channel_id, current_time('Y-m-d'), date('Y-m-d', strtotime('+1 day'))); | |
| $start_timestamp = current_time('timestamp'); | |
| $end_timestamp = $start_timestamp + DAY_IN_SECONDS; | |
| $start_date = date_i18n('Y-m-d', $start_timestamp); | |
| $end_date = date_i18n('Y-m-d', $end_timestamp); | |
| $schedules = cablecast_get_schedules($channel_id, $start_date, $end_date); |
| 'manage_terms' => 'manage_categories', | ||
| 'edit_terms' => 'manage_categories', | ||
| 'delete_terms' => 'manage_categories', | ||
| 'assign_terms' => 'edit_posts' |
Copilot
AI
Jan 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The taxonomy capabilities have been changed from empty strings (no permissions) to allowing users with 'manage_categories' and 'edit_posts' capabilities. This is a significant permission change that allows editors to modify series/project terms. Ensure this is intentional and aligns with the desired security model, as it could allow unintended modifications to synced Cablecast data.
| 'relation' => 'OR', | ||
| [ | ||
| 'key' => '_cablecast_hide_from_listings', | ||
| 'compare' => 'NOT EXISTS', | ||
| ], | ||
| [ | ||
| 'key' => '_cablecast_hide_from_listings', | ||
| 'value' => '1', | ||
| 'compare' => '!=', | ||
| ], | ||
| ]; | ||
|
|
||
| // Exclude CG exempt shows | ||
| $meta_query[] = [ | ||
| 'relation' => 'OR', | ||
| [ | ||
| 'key' => 'cablecast_show_cg_exempt', | ||
| 'compare' => 'NOT EXISTS', | ||
| ], | ||
| [ | ||
| 'key' => 'cablecast_show_cg_exempt', | ||
| 'value' => '1', | ||
| 'compare' => '!=', | ||
| ], |
Copilot
AI
Jan 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The meta query logic is checking if the key does not exist OR if it's not equal to '1', which creates a complex OR condition. Consider simplifying by only checking 'compare' => '!=' since WordPress treats non-existent meta as empty/false. This would make the query more efficient and easier to understand.
| 'relation' => 'OR', | |
| [ | |
| 'key' => '_cablecast_hide_from_listings', | |
| 'compare' => 'NOT EXISTS', | |
| ], | |
| [ | |
| 'key' => '_cablecast_hide_from_listings', | |
| 'value' => '1', | |
| 'compare' => '!=', | |
| ], | |
| ]; | |
| // Exclude CG exempt shows | |
| $meta_query[] = [ | |
| 'relation' => 'OR', | |
| [ | |
| 'key' => 'cablecast_show_cg_exempt', | |
| 'compare' => 'NOT EXISTS', | |
| ], | |
| [ | |
| 'key' => 'cablecast_show_cg_exempt', | |
| 'value' => '1', | |
| 'compare' => '!=', | |
| ], | |
| 'key' => '_cablecast_hide_from_listings', | |
| 'value' => '1', | |
| 'compare'=> '!=', | |
| ]; | |
| // Exclude CG exempt shows | |
| $meta_query[] = [ | |
| 'key' => 'cablecast_show_cg_exempt', | |
| 'value' => '1', | |
| 'compare'=> '!=', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $producers_archive = get_post_type_archive_link('show'); | ||
| if ($producers_archive) { | ||
| $output .= '<a href="' . esc_url(add_query_arg('browse', 'producers', $producers_archive)) . '" class="cablecast-home__browse-link">'; |
Copilot
AI
Jan 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable name $producers_archive is misleading since it actually gets the 'show' post type archive link, not a producers-specific archive. Consider renaming to $shows_archive to accurately reflect what the link points to.
| $producers_archive = get_post_type_archive_link('show'); | |
| if ($producers_archive) { | |
| $output .= '<a href="' . esc_url(add_query_arg('browse', 'producers', $producers_archive)) . '" class="cablecast-home__browse-link">'; | |
| $shows_archive = get_post_type_archive_link('show'); | |
| if ($shows_archive) { | |
| $output .= '<a href="' . esc_url(add_query_arg('browse', 'producers', $shows_archive)) . '" class="cablecast-home__browse-link">'; |
Summary
This branch builds on the bug fixes in master (9f392b5) and adds test coverage to verify the fixes work correctly.
Test plan
🤖 Generated with Claude Code