Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Pest Plugin Test Time Laravel Package

spatie/pest-plugin-test-time

Pest plugin to control time in tests via Carbon::setTestNow(): freeze “now” and easily move it forward/backward (e.g., addMinute). Includes a toBeCarbon expectation for asserting Carbon dates/times and formats.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Prioritizes test reliability for time-sensitive features (e.g., subscription expirations, token validation, cron jobs), reducing flaky tests caused by real-time dependencies.
  • Accelerates roadmap delivery by eliminating manual time-management boilerplate, freeing engineering bandwidth for feature development.
  • Validates "buy over build" by offering a lightweight, battle-tested solution that integrates natively with Pest and Laravel’s ecosystem—avoiding custom implementation costs.
  • Enables clear test scenarios for business-critical logic (e.g., "What happens if a user’s trial expires at 11:59 PM?") with minimal setup.

When to Consider This Package

Adopt this package when:

  • Your project uses Pest for testing (not PHPUnit).
  • You have significant time-dependent logic in your application (e.g., scheduled tasks, expiring resources, rate limiting).
  • Test flakiness due to real-time dependencies is impacting CI/CD reliability or developer velocity.
  • You prioritize readable, expressive tests over low-level time manipulation.

Look elsewhere if:

  • Your project uses PHPUnit instead of Pest (this is Pest-specific).
  • Your application has no time-sensitive logic (e.g., static content sites, non-time-dependent APIs).
  • Your team already has a robust custom time-handling solution with no pain points.

How to Pitch It (Stakeholders)

This plugin eliminates time-related test flakiness with a simple, Pest-native API to freeze, travel, and reset time—no more manual Carbon::setTestNow() clutter. For executives, it reduces production bugs from time-dependent logic and accelerates feature delivery by ensuring tests are deterministic and maintainable. For engineering, it streamlines test writing with clean, readable syntax that works seamlessly with Laravel’s time helpers, cutting test setup time by ~70% while improving reliability. MIT-licensed and maintained by Spatie, it’s a zero-cost, high-impact upgrade for any Laravel team using Pest.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport