Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
d021ed3
Release remaining idle database connections after a failure
binaryfire Nov 17, 2026
ed41d83
Use Double master for the components test suite
binaryfire Nov 17, 2026
75818e8
Clarify object identity in Double expectations
binaryfire Nov 17, 2026
7f2e365
Match the role event dispatcher call in the listener guard test
binaryfire Nov 18, 2026
cf0ff76
Check the container instance passed to queue connections
binaryfire Nov 18, 2026
a83cc55
Assert the SQS operation recorded during pooled job deletion
binaryfire Nov 18, 2026
fe4b9e9
Remove ineffective empty-handler assertions from SQS batch tests
binaryfire Nov 18, 2026
3582919
Record rate limiter updates after argument matching succeeds
binaryfire Nov 18, 2026
442b49e
Order test traits consistently and clarify the Redis unlink fixture
binaryfire Nov 18, 2026
1d73769
Clarify strict mock conversion and argument capture in Double tests
binaryfire Nov 18, 2026
fb57a06
Apply strict Double expectations consistently to ported tests
binaryfire Nov 18, 2026
0341545
Reject unexpected interactions in AI and API client tests
binaryfire Nov 18, 2026
8686592
Preserve authentication collaborator and user identity expectations
binaryfire Nov 18, 2026
a924df5
Make broadcasting expectations explicit and capture matched publications
binaryfire Nov 18, 2026
d1bf4e1
Verify bus batch dispatch, PostgreSQL inserts and job forwarding
binaryfire Nov 18, 2026
5307fa0
Capture confirmed database, exception and queue interactions
binaryfire Nov 18, 2026
8a025c2
Record search request headers when the client is called
binaryfire Nov 18, 2026
71a84ff
Verify the exact sequence of Redis session connection lookups
binaryfire Nov 18, 2026
c073145
Explain policy cache keys and store-wide cache flush events
binaryfire Nov 18, 2026
30627b3
Check the original cache repository and reported broadcast failures
binaryfire Nov 18, 2026
e75f392
Tighten Redis cache operation and tag flush tests
binaryfire Nov 18, 2026
1373be1
Tighten cache store and repository double expectations
binaryfire Nov 18, 2026
392fb3c
Reject unexpected calls in connection pool tests
binaryfire Nov 18, 2026
1945068
Check scheduler collaborators and exception identity
binaryfire Nov 18, 2026
0bffe6c
Tighten console command and signal expectations
binaryfire Nov 18, 2026
2020528
Clarify container, cookie and timer test expectations
binaryfire Nov 18, 2026
2f6a35e
Verify reported failures by identity in worker and coroutine tests
binaryfire Nov 18, 2026
095b419
Use strict doubles for Data services and transformers
binaryfire Nov 18, 2026
9e0822a
Express console termination without a command as a no-throw test
binaryfire Nov 18, 2026
2fd1340
Tighten database CLI process and container expectations
binaryfire Nov 18, 2026
dc51630
Preserve identity and exercise real Eloquent query forwarding
binaryfire Nov 18, 2026
1c6ccf3
Verify migration and seeding collaborators in strict mode
binaryfire Nov 18, 2026
fd6a821
Check the process arguments and SQL used by schema dumps and loads
binaryfire Nov 18, 2026
ca223cd
Make schema grammar fixtures describe their database drivers
binaryfire Nov 18, 2026
e357b6e
Reject unexpected interactions in database query tests
binaryfire Nov 18, 2026
dea8825
Tighten connection, transaction and database lock tests
binaryfire Nov 18, 2026
6bc0947
Reject unexpected calls in diagnostic and service tests
binaryfire Nov 18, 2026
0dbc377
Verify coroutine identity and event forwarding
binaryfire Nov 18, 2026
4df3d30
Tighten filesystem forwarding and failure assertions
binaryfire Nov 18, 2026
8393a23
Make Fortify test collaborators strict
binaryfire Nov 18, 2026
d341309
Exercise parallel database guards under isolated worker tokens
binaryfire Nov 18, 2026
c6a987c
Verify middleware configuration and exception forwarding
binaryfire Nov 18, 2026
2d4e0d2
Distinguish invalid gRPC durations from overflow in tests
binaryfire Nov 18, 2026
3446c04
Check Horizon supervisor and payload identity
binaryfire Nov 18, 2026
f03bbd6
Clarify that assertions are side effects in Double matchers
binaryfire Nov 18, 2026
584d894
Assert on dispatched jobs and events after dispatch
binaryfire Nov 18, 2026
c11301e
Check Redis script calls after the expectation matches
binaryfire Nov 18, 2026
4463519
Separate console, filesystem and search assertions from argument matc…
binaryfire Nov 18, 2026
3816499
Exercise permission scopes with integer and UUID fixture keys
binaryfire Nov 18, 2026
3e42ddf
Clarify HTTP and image expectations and failure assertions
binaryfire Nov 18, 2026
7063ed5
Preserve error and instrument identity in pool and telemetry tests
binaryfire Nov 18, 2026
d4040b1
Tighten authentication and token-cache test expectations
binaryfire Nov 18, 2026
494f333
Tighten test doubles for mail, notifications and process results
binaryfire Nov 18, 2026
430346f
Verify outbox settlement and worker options at the call boundary
binaryfire Nov 18, 2026
c7b0429
Strengthen queue transport and cleanup tests
binaryfire Nov 18, 2026
d7d818d
Verify queue command options and worker events
binaryfire Nov 18, 2026
e35822b
Reject unexpected calls in queue and integration tests
binaryfire Nov 18, 2026
a066f77
Check Redis cluster selection and event registration
binaryfire Nov 18, 2026
72b4f8a
Verify local broadcasts, slot limits and webhook delivery
binaryfire Nov 18, 2026
0c9584a
Tighten routing, authentication and search tests
binaryfire Nov 18, 2026
05a3ec5
Check server, session and failure-reporting interactions
binaryfire Nov 18, 2026
c455d15
Check observable support helper and facade behavior
binaryfire Nov 18, 2026
66e64d0
Verify Testbench skip actions and queue payload handling
binaryfire Nov 18, 2026
68a5243
Verify validation query forwarding and rule rejection
binaryfire Nov 18, 2026
47c4b24
Check view rendering and watcher interactions
binaryfire Nov 18, 2026
7860f72
Use a real container in WebSocket callback tests
binaryfire Nov 18, 2026
d66ff0c
Merge remote-tracking branch 'origin/0.4' into upstream-sync-2026-11-…
binaryfire Nov 18, 2026
397c5d3
Model healthy Redis clients in release tests
binaryfire Nov 18, 2026
c21032f
Model a failed stream read without a timeout
binaryfire Nov 18, 2026
c90d570
Complete the Sentry telemetry fixtures
binaryfire Nov 18, 2026
3dab76a
Allow unrelated application reads in the Tinker caster test
binaryfire Nov 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,11 @@ A per-package base class is only justified when there is shared setUp logic —

Use Double for test doubles in new tests. When porting, convert direct Mockery mocks and spies to Double regardless of the upstream library; keep upstream PHPUnit doubles. Retain Mockery where required to use or test framework APIs backed by it, such as `$this->mock()`, facade expectations and `Sanctum::actingAs()`. Add `JMac\Testing\Integrations\PHPUnit\VerifiesDoubles` to each test class using Double; it owns verification and cleanup.

Double is lenient by default. Use `expects('method')->never()` to forbid a call, or `unused()` after exercising the code to assert no calls occurred. `allows()->with(...)` neither requires a matching call nor rejects other arguments. `expects()->with(...)` requires the call and rejects unmatched arguments for that method. Use `strict()` when calls to unconfigured methods must fail.
Double is lenient by default. Use `expects('method')->never()` to forbid a call, or `unused()` after exercising the code to assert no calls occurred. `allows()->with(...)` neither requires a matching call nor rejects other arguments. `expects()->with(...)` requires the call and rejects unmatched arguments for that method. Use `strict()` unless the test deliberately ignores unrelated calls; this applies equally to tests ported from upstream.

`with()` compares objects, including doubles, using `==`. Use `Argument::same($object)` when the exact instance matters or to preserve Mockery’s default identity check.

Keep matcher predicates free of side effects, including assertions. Use `Argument::capture()` to save an argument or `resolves()` to record a matched call.

Do not overlap `allows()` stubs with `expects()` constraints when enforcing maximum call counts or `never()`; a matching stub can absorb those calls regardless of registration order.

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"fakerphp/faker": "^1.24",
"friendsofphp/php-cs-fixer": "^3.57.2",
"intervention/image": "^4.2",
"jasonmccreary/double": "^1.1.1",
"jasonmccreary/double": "dev-master",
"league/flysystem-ftp": "^3.36",
"league/flysystem-google-cloud-storage": "^3.0",
"league/flysystem-sftp-v3": "^3.36",
Expand Down
6 changes: 3 additions & 3 deletions src/auth/src/Access/Gate.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,9 @@ public function getPolicyFor(object|string $class): mixed
$policyClass = $this->policyClassCache[$class] ?? null;

if ($policyClass === null) {
// Only declared model names are cached. Other inputs may be user data, so their
// policy guesses are normalized to avoid unbounded worker state. For those inputs,
// register policies explicitly when relying on container configuration for PHP class aliases.
// Cache only declared model names. Normalize other guesses so the container doesn't
// cache a policy instance per user-supplied spelling. Register policies explicitly
// when those inputs rely on container configuration for PHP class aliases.
$isDeclaredClass = class_exists($class) && (new ReflectionClass($class))->getName() === $class;
$policyClass = $this->resolvePolicyClass($class, $isDeclaredClass);

Expand Down
12 changes: 11 additions & 1 deletion src/database/src/ConnectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,21 @@ public function connectionDateFormat(UnitEnum|string|null $name = null): string
*/
public static function releaseIdleConnections(): void
{
$failure = null;

foreach (CoroutineContext::getContainer() ?? [] as $value) {
if ($value instanceof ConnectionLease) {
$value->releaseIfIdle();
try {
$value->releaseIfIdle();
} catch (Throwable $exception) {
$failure = Coroutine::preferCancellation($failure, $exception);
}
}
}

if ($failure !== null) {
throw $failure;
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Ai/BroadcastBatchingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public function testCancellationWhileFinishingBroadcastsCancelsTheSender(bool $c
{
config(['broadcasting.default' => 'null', 'ai.broadcasting.batching.max_bytes' => 1]);
$failure = $cleanupThrows ? new RuntimeException('Release cleanup failed.', previous: new CanceledException) : new CanceledException;
$lease = Double::for(ConnectionLease::class);
$lease = Double::for(ConnectionLease::class)->strict();
$lease->expects('releaseIfIdle')->throws($failure);
$waiting = new Channel(1);
$senderCanceled = false;
Expand Down
26 changes: 13 additions & 13 deletions tests/Ai/ConcurrentToolsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ public function testOptedInToolsAreBoundedOrderedAndUseTheCapturedContext(bool $
Coroutine::afterCreated(static function (): void {
CoroutineContext::set('tool-test.account', 'startup');
});
$providerGateway = Double::for(Gateway::class);
$providerGateway = Double::for(Gateway::class)->strict();
Ai::extend('tool-test', static fn (Application $app, array $config): Provider => new class($providerGateway, $config, $app->make(Dispatcher::class)) extends Provider {});
$accountProvider = Ai::build(['name' => 'tool-account', 'driver' => 'tool-test', 'key' => 'account-key']);
$active = 0;
$maximum = 0;
$accounts = [];
$requestIds = [];
$resolvedProviders = [];
$tool = Double::for(NamedTool::class);
$tool = Double::for(NamedTool::class)->strict();
$tool->allows('name')->returns('tool');
$tool->expects('handle')->times(3)->resolves(function (Request $request) use (&$active, &$maximum, &$accounts, &$requestIds, &$resolvedProviders): string {
$this->assertSame('tool-connection', DB::getDefaultConnection());
Expand All @@ -100,7 +100,7 @@ public function testOptedInToolsAreBoundedOrderedAndUseTheCapturedContext(bool $
}
});
$calls = [new ToolCall('first', 'tool', []), new ToolCall('second', 'tool', []), new ToolCall('third', 'tool', [])];
$provider = Double::for(TextProvider::class);
$provider = Double::for(TextProvider::class)->strict();
$provider->allows('name')->returns('provider');
$results = [];
$gateway = $this->gateway($streaming, $calls, $results);
Expand Down Expand Up @@ -134,9 +134,9 @@ public static function deliveryModes(): array

public function testInvalidConcurrencyFailsClearlyThroughTheLoop(): void
{
$provider = Double::for(TextProvider::class);
$provider = Double::for(TextProvider::class)->strict();
$provider->allows('name')->returns('provider');
$gateway = Double::for(StepTextGateway::class);
$gateway = Double::for(StepTextGateway::class)->strict();
$gateway->expects('generateTextStep')->returns(new StepResponse('Finished', [], FinishReason::Stop, new TextUsage, new Meta));

$this->expectException(InvalidArgumentException::class);
Expand Down Expand Up @@ -164,7 +164,7 @@ public function testToolFailureCancelsAndJoinsTheOtherTools(bool $canceled, bool

$active = 0;
$resumed = false;
$tool = Double::for(NamedTool::class);
$tool = Double::for(NamedTool::class)->strict();
$tool->allows('name')->returns('tool');
$tool->expects('handle')->times(2)->resolves(function (Request $request) use ($failure, &$active, &$resumed): string {
++$active;
Expand All @@ -184,14 +184,14 @@ public function testToolFailureCancelsAndJoinsTheOtherTools(bool $canceled, bool
--$active;
}
});
$provider = Double::for(TextProvider::class);
$provider = Double::for(TextProvider::class)->strict();
$provider->allows('name')->returns('provider');
$results = [];
$gateway = $this->gateway(false, [new ToolCall('first', 'tool', []), new ToolCall('second', 'tool', [])], $results, completes: false);
$caught = null;

try {
(new TextGenerationLoop($gateway))->generate($provider, 'model', '', tools: [$tool], options: new TextGenerationOptions(agent: new ConcurrentToolsTestAgent('', [], [])), context: new RunContext('invocation', Double::for(Agent::class), $provider, 'model', $events));
(new TextGenerationLoop($gateway))->generate($provider, 'model', '', tools: [$tool], options: new TextGenerationOptions(agent: new ConcurrentToolsTestAgent('', [], [])), context: new RunContext('invocation', Double::for(Agent::class)->strict(), $provider, 'model', $events));
} catch (Throwable $exception) {
$caught = $exception;
}
Expand All @@ -213,7 +213,7 @@ public function testAbandoningLiveSubAgentOutputCancelsAndJoinsItsProducers(): v
$active = 0;
$resumed = false;
$waiting = new Channel(1);
$agent = Double::for(Agent::class, CanActAsTool::class);
$agent = Double::for(Agent::class, CanActAsTool::class)->strict();
$agent->allows('name')->returns('child');
$agent->expects('stream')->times(2)->resolves(function (string $task) use (&$active, &$resumed, $waiting): StreamableAgentResponse {
return new StreamableAgentResponse($task, function () use ($task, &$active, &$resumed, $waiting): Generator {
Expand All @@ -228,7 +228,7 @@ public function testAbandoningLiveSubAgentOutputCancelsAndJoinsItsProducers(): v
}
});
});
$provider = Double::for(TextProvider::class);
$provider = Double::for(TextProvider::class)->strict();
$provider->allows('name')->returns('provider');
$results = [];
$gateway = $this->gateway(true, [
Expand Down Expand Up @@ -270,7 +270,7 @@ public function testCancelingTheConsumerCancelsAndJoinsTheTools(bool $throwExcep
$resumed = false;
$caught = null;
$waiting = new Channel(1);
$tool = Double::for(NamedTool::class);
$tool = Double::for(NamedTool::class)->strict();
$tool->allows('name')->returns('tool');
$tool->expects('handle')->times(2)->resolves(function () use ($waiting, &$active, &$resumed): string {
++$active;
Expand All @@ -284,7 +284,7 @@ public function testCancelingTheConsumerCancelsAndJoinsTheTools(bool $throwExcep
--$active;
}
});
$provider = Double::for(TextProvider::class);
$provider = Double::for(TextProvider::class)->strict();
$provider->allows('name')->returns('provider');
$results = [];
$gateway = $this->gateway(true, [new ToolCall('first', 'tool', []), new ToolCall('second', 'tool', [])], $results, completes: false);
Expand Down Expand Up @@ -335,7 +335,7 @@ private function gateway(bool $streaming, array $calls, array &$results, bool $c

return new StepResponse('Finished', [], FinishReason::Stop, new TextUsage, new Meta);
};
$gateway = Double::for(StepTextGateway::class);
$gateway = Double::for(StepTextGateway::class)->strict();

if ($streaming) {
$gateway->expects('generateStreamStep')->times($completes ? 2 : 1)->resolves(static function (...$arguments) use ($response): Generator {
Expand Down
18 changes: 9 additions & 9 deletions tests/Ai/CoroutineIsolationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function (): array {

public function testOverlappingCallbacksReserveSeparateSequenceEntries(): void
{
$provider = Double::for(AudioProvider::class);
$provider = Double::for(AudioProvider::class)->strict();
$provider->allows('name')->returns('audio');
$gateway = new FakeAudioGateway([
function (): string {
Expand All @@ -209,7 +209,7 @@ public function testSharedGenerationLoopKeepsRepairSettingsLocalWhileApprovalChe
{
$repairStarted = new Channel(1);
$ordinaryStarted = new Channel(1);
$tool = Double::for(ApprovableNamedTool::class);
$tool = Double::for(ApprovableNamedTool::class)->strict();
$tool->allows('name')->returns('known');
$tool->expects('shouldRequestApproval')->times(2)->resolves(static function (Request $request) use ($repairStarted, $ordinaryStarted): null {
if ($request['repair']) {
Expand All @@ -223,9 +223,9 @@ public function testSharedGenerationLoopKeepsRepairSettingsLocalWhileApprovalChe
return null;
});
$tool->expects('handle')->times(2)->returns('done');
$provider = Double::for(TextProvider::class);
$provider = Double::for(TextProvider::class)->strict();
$provider->allows('name')->returns('provider');
$gateway = Double::for(StepTextGateway::class);
$gateway = Double::for(StepTextGateway::class)->strict();
$steps = [];
$gateway->expects('generateTextStep')->times(4)->resolves(static function (...$arguments) use (&$steps): StepResponse {
$instructions = $arguments[2];
Expand Down Expand Up @@ -263,9 +263,9 @@ function () use ($repairStarted, $loop, $provider, $tool): TextResponse {
#[DataProvider('generatedResponses')]
public function testGeneratedResponseKeepsItsFilenameAcrossCoroutines(GeneratedImage|AudioResponse $response): void
{
$disk = Double::for(Filesystem::class);
$disk = Double::for(Filesystem::class)->strict();
$disk->expects('put')->with(Argument::type('string'), 'generated bytes', [])->times(3)->returns(true);
$filesystems = Double::for(FilesystemFactory::class);
$filesystems = Double::for(FilesystemFactory::class)->strict();
$filesystems->expects('disk')->with('generated')->times(3)->returns($disk);
Container::getInstance()->instance(FilesystemFactory::class, $filesystems);

Expand Down Expand Up @@ -430,15 +430,15 @@ protected function captureAccountContext(): Closure
*/
protected function manager(): AiManager
{
$application = Double::for(Application::class, override: true);
$application = Double::for(Application::class, override: true)->strict();
$application->allows('make')->with('config')->returns(new Repository([
'ai' => [
'default' => 'configured',
'providers' => ['configured' => ['driver' => 'custom', 'key' => 'configured-key']],
],
]));
$gateway = Double::for(Gateway::class);
$events = Double::for(Dispatcher::class);
$gateway = Double::for(Gateway::class)->strict();
$events = Double::for(Dispatcher::class)->strict();
$manager = new AiManager($application->instance());
$manager->extend('custom', static fn (Application $application, array $config): Provider => new IsolationTestProvider($gateway, $config, $events));

Expand Down
4 changes: 2 additions & 2 deletions tests/Ai/Feature/AgentProviderSelectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ protected function getProvidersAndModels(Provider|Lab|array|string|null $provide
#[DataProvider('generationMethods')]
public function testContractOnlyProvidersCanFailOverAndDispatchTheirIdentity(string $method): void
{
$primary = Double::for(TextProvider::class);
$primary = Double::for(TextProvider::class)->strict();
$primary->expects($method)->throws(RateLimitedException::forProvider('contract'));
Ai::extend('contract', static fn (): TextProvider => $primary);

Expand Down Expand Up @@ -260,7 +260,7 @@ public static function generationMethods(): array
protected function provider(array $config): Provider&DoubleInterface
{
$provider = Double::for(ProviderSelectionTextProvider::class)->passthru();
$provider->__construct(Double::for(Gateway::class), $config, $this->app->make(Dispatcher::class));
$provider->__construct(Double::for(Gateway::class)->strict(), $config, $this->app->make(Dispatcher::class));
$provider->allows('defaultTextModel')->returns('test-model');

return $provider;
Expand Down
2 changes: 1 addition & 1 deletion tests/Ai/Feature/AiManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function testDriverExtensionsSurviveBetweenQueueJobs(): void

public function testCustomDriversMayImplementProviderContractsWithoutExtendingTheBaseClass(): void
{
$provider = Double::for(AudioProvider::class);
$provider = Double::for(AudioProvider::class)->strict();
$this->manager->extend('custom', static fn (): AudioProvider => $provider);

$this->assertSame($provider, $this->manager->audioProvider());
Expand Down
2 changes: 1 addition & 1 deletion tests/Ai/Feature/BroadcastAgentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function testAnOversizedBroadcastFrameDoesNotAbortTheStreamAndThenStillRe
{
AssistantAgent::fake(['Hello world']);

$pending = Double::for(AnonymousEvent::class);
$pending = Double::for(AnonymousEvent::class)->strict();
$pending->allows('as');
$pending->allows('with');
$pending->expects('sendNow')->times(minimum: 1)->throws(new BroadcastException('Payload too large'));
Expand Down
4 changes: 2 additions & 2 deletions tests/Ai/Feature/EmbeddingsCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public static function cacheModes(): array

public function testSameNameOnDemandProvidersRetainTheirOwnCacheIdentity(): void
{
$gateway = Double::for(Gateway::class);
$gateway = Double::for(Gateway::class)->strict();
$gateway->expects('generateEmbeddings')->times(2)->resolves(
fn (EmbeddingProvider $provider): EmbeddingsResponse => new EmbeddingsResponse(
[[$provider->providerCredentials()['key'] === 'first-key' ? 1 : 2]],
Expand Down Expand Up @@ -378,7 +378,7 @@ public function testDisabledCachingDoesNotResolveCacheScope(): void
protected function useCustomProvider(Closure $generate): void
{
Ai::extend('cache-test', function (Application $app, array $config) use ($generate): EmbeddingProvider {
$provider = Double::for(EmbeddingProvider::class);
$provider = Double::for(EmbeddingProvider::class)->strict();
$provider->allows('name')->returns('cache-test');
$provider->allows('driver')->returns('cache-test');
$provider->allows('providerCredentials')->returns(['key' => $config['key']]);
Expand Down
12 changes: 6 additions & 6 deletions tests/Ai/Feature/FilesystemToolsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function testFilesystemCancellationIsNotConvertedToAToolResult(string $to
if ($cleanupThrows) {
$cancellation = new RuntimeException('Filesystem cleanup failed.', previous: $cancellation);
}
$disk = Double::for(FilesystemAdapter::class);
$disk = Double::for(FilesystemAdapter::class)->strict();
$disk->allows('fileExists')->returns(true);
foreach (['size' => 10, 'lastModified' => 1, 'mimeType' => 'text/plain', 'getVisibility' => 'public'] as $operation => $value) {
if ($operation !== $method) {
Expand Down Expand Up @@ -155,7 +155,7 @@ public function testLookupFailuresForExistingFilesAreReportedInsteadOfDescribedA
{
Exceptions::fake();
$failure = UnableToRetrieveMetadata::fileSize('file.txt', 'Access denied.');
$disk = Double::for(FilesystemAdapter::class);
$disk = Double::for(FilesystemAdapter::class)->strict();
$disk->expects('size')->with('file.txt')->throws($failure);
$disk->expects('fileExists')->with('file.txt')->returns(true);

Expand Down Expand Up @@ -239,7 +239,7 @@ public function testReadFileRejectsABinaryFile(): void

public function testReadFileReportsAnUnreadableFile(): void
{
$disk = Double::for(FilesystemAdapter::class);
$disk = Double::for(FilesystemAdapter::class)->strict();
$disk->expects('size')->with('note.txt')->returns(10);
$disk->expects('get')->with('note.txt')->returns(null);

Expand Down Expand Up @@ -360,7 +360,7 @@ public function testDeleteFileDoesNotReportDirectoriesAsFiles(): void

public function testDeleteFileReportsDeleteFailures(): void
{
$disk = Double::for(Filesystem::class);
$disk = Double::for(Filesystem::class)->strict();
$disk->expects('fileExists')->with('gone.txt')->returns(true);
$disk->expects('delete')->with('gone.txt')->returns(false);

Expand Down Expand Up @@ -399,7 +399,7 @@ public function testCopyFileDoesNotCopyDirectories(): void

public function testCopyFileReportsCopyFailures(): void
{
$disk = Double::for(Filesystem::class);
$disk = Double::for(Filesystem::class)->strict();
$disk->expects('fileExists')->with('a.txt')->returns(true);
$disk->expects('copy')->with('a.txt', 'b.txt')->returns(false);

Expand Down Expand Up @@ -439,7 +439,7 @@ public function testMoveFileDoesNotMoveDirectories(): void

public function testMoveFileReportsMoveFailures(): void
{
$disk = Double::for(Filesystem::class);
$disk = Double::for(Filesystem::class)->strict();
$disk->expects('fileExists')->with('a.txt')->returns(true);
$disk->expects('move')->with('a.txt', 'b.txt')->returns(false);

Expand Down
Loading
Loading