feat: temporal expressions and 90% test coverage#2
Merged
Conversation
Temporal Extensions (ADR-001): - Add TemporalResolver for NOW, TODAY, and TEMPORAL expressions - Implement CRON-based scheduling (nextRun, previousRun, isDue) - Add time range evaluation (08:00-18:00) - Support nth/last weekday conditions (first Saturday, last Friday) - Add custom evaluator registration for business logic Core temporal components: - TemporalExpression: Boolean expression parser (weekday && !holiday) - ExpressionParser: Tokenizer for temporal expressions - CronWrapper: CRON expression evaluation via dragonmantank/cron-expression - TimeRange: Time-of-day range checking with overnight support - ConditionRegistry: Centralized condition management Condition implementations: - WeekdayCondition, WeekendCondition - CronCondition, TimeRangeCondition - NthWeekdayCondition, LastWeekdayCondition - AlwaysCondition, NeverCondition, CustomCondition Test coverage improvements (68.7% → 90.0%): - 792 tests with 1,141 assertions - New tests for TokenCollection, ConditionRegistry - New tests for DynamicFieldResolver, TableResolver - New tests for Cache, Accessors, Exceptions - Full coverage for TemporalResolver and all conditions Configuration: - Add Infection mutation testing configuration - Update phpunit.xml.dist with coverage settings - Add dragonmantank/cron-expression dependency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dragonmantank/cron-expressionfor cron-based schedulingholiday,astronomical_day)Features
New Temporal Tokens
{{TEMPORAL:isDue('weekday && 08:00-18:00')}}- Boolean evaluation{{TEMPORAL:nextRun('cron:0 8 * * 1-5')}}- Next scheduled run{{NOW:format('Y-m-d')}}- Current datetime functions{{TODAY:startOfDay}}- Today-based calculationsExpression Syntax
Core Components
TemporalResolverExpressionParserTimeRangeCronWrapperConditionRegistryConditions
WeekdayCondition,WeekendConditionCronCondition,TimeRangeConditionNthWeekdayCondition,LastWeekdayConditionAlwaysCondition,NeverCondition,CustomConditionTest Plan
Breaking Changes
None. This is a feature addition.
Dependencies
dragonmantank/cron-expression: ^3.3infection/infection: ^0.29