File: /home/xedaptot/ai.naniguide.com/tests/Pest.php
<?php
/*
|--------------------------------------------------------------------------
| Test Case
|--------------------------------------------------------------------------
|
| The closure you provide to your test functions is always bound to a specific PHPUnit test
| case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may
| need to change it using the "uses()" function to bind a different classes or traits.
|
*/
// uses(Tests\TestCase::class)->in('Feature');
// Runtime executor tests touch Eloquent date casts which require a Laravel
// container + DB connection resolver; bind TestCase only for that subtree.
uses(Tests\TestCase::class)->in('Unit/Domain/Automation/Runtime');
/*
|--------------------------------------------------------------------------
| Expectations
|--------------------------------------------------------------------------
|
| When you're writing tests, you often need to check that values meet certain conditions. The
| "expect()" function gives you access to a set of "expectations" methods that you can use
| to assert different things. Of course, you may extend the Expectation API at any time.
|
*/
expect()->extend('toBeOne', function () {
return $this->toBe(1);
});
/*
|--------------------------------------------------------------------------
| Functions
|--------------------------------------------------------------------------
|
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
| project that you don't want to repeat in every file. Here you can also expose helpers as
| global functions to help you to reduce the number of lines of code in your test files.
|
*/
function something()
{
// ..
}
// AI tests moved into the acelle/ai plugin (W6 of the AI-extraction
// plan). The plugin-active seeding lives in
// `storage/app/plugins/acelle/ai/tests/Pest.php` now.
/*
|--------------------------------------------------------------------------
| Defense net — reset PHP time limit between every test.
|--------------------------------------------------------------------------
|
| Pest runs the entire suite inside a single PHP process. Any production
| code that calls set_time_limit(N) with N > 0 leaks the limit to every
| subsequent test in the run; once cumulative CPU time crosses N seconds
| the process fatals with "Maximum execution time of N seconds exceeded"
| at whatever line it happened to be executing — usually somewhere
| innocent in autoload / route registration / class loading, masking the
| true offender.
|
| First documented offender: `UpgradeManager::downloadPatchTo()` was
| calling set_time_limit($timeout + 60) without a finally restore. With
| the test's $timeout=2 that meant max_execution_time=62 leaked into
| the process for the rest of the run. Fixed at the source 2026-05-10,
| but this hook stays as a belt-and-braces guard against the next
| occurrence (other historical offenders: Plugin::install, Downloader,
| namespaced_helpers — any helper that legitimately needs a long limit
| during a real CLI/web request, but not during a test).
*/
pest()->afterEach(function () {
@set_time_limit(0);
});