@@ -82,4 +82,45 @@ public function testClearContextResetsRemoteContentAssetsManifestUrls(): void
8282
8383 self ::assertSame ([], $ context ->getRemoteContentAssetsManifestUrls ());
8484 }
85+
86+ public function testOverrideAgentImageReplacesCurrentImage (): void
87+ {
88+ $ context = new AgentExecutionContext ();
89+ $ context ->setContext ('ws-id ' , '/path ' , null , 'project ' , 'node:22-slim ' );
90+
91+ $ context ->overrideAgentImage ('app-image-with-cursor-cli ' );
92+
93+ self ::assertSame ('app-image-with-cursor-cli ' , $ context ->getAgentImage ());
94+ }
95+
96+ public function testRestoreAgentImageBringsBackOriginal (): void
97+ {
98+ $ context = new AgentExecutionContext ();
99+ $ context ->setContext ('ws-id ' , '/path ' , null , 'project ' , 'node:22-slim ' );
100+
101+ $ context ->overrideAgentImage ('app-image-with-cursor-cli ' );
102+ $ context ->restoreAgentImage ();
103+
104+ self ::assertSame ('node:22-slim ' , $ context ->getAgentImage ());
105+ }
106+
107+ public function testRestoreAgentImageIsNoOpWithoutOverride (): void
108+ {
109+ $ context = new AgentExecutionContext ();
110+ $ context ->setContext ('ws-id ' , '/path ' , null , 'project ' , 'node:22-slim ' );
111+
112+ $ context ->restoreAgentImage ();
113+
114+ self ::assertSame ('node:22-slim ' , $ context ->getAgentImage ());
115+ }
116+
117+ public function testClearContextResetsOverriddenAgentImage (): void
118+ {
119+ $ context = new AgentExecutionContext ();
120+ $ context ->setContext ('ws-id ' , '/path ' , null , 'project ' , 'node:22-slim ' );
121+ $ context ->overrideAgentImage ('app-image ' );
122+ $ context ->clearContext ();
123+
124+ self ::assertNull ($ context ->getAgentImage ());
125+ }
85126}
0 commit comments