style: fix pint code style issues
This commit is contained in:
parent
db0cc0abad
commit
f2f27ec766
6 changed files with 68 additions and 35 deletions
|
|
@ -9,7 +9,6 @@ declare(strict_types=1);
|
|||
* for all create, list, and revoke operations.
|
||||
*/
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Core\Mod\Agentic\Models\AgentApiKey;
|
||||
use Core\Mod\Agentic\Services\AgentApiKeyService;
|
||||
use Core\Tenant\Models\Workspace;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use Illuminate\Support\Facades\Cache;
|
|||
|
||||
describe('ForAgentsController cache key', function () {
|
||||
it('uses the default namespaced cache key', function () {
|
||||
$controller = new ForAgentsController();
|
||||
$controller = new ForAgentsController;
|
||||
|
||||
expect($controller->cacheKey())->toBe('agentic.for-agents.json');
|
||||
});
|
||||
|
|
@ -26,7 +26,7 @@ describe('ForAgentsController cache key', function () {
|
|||
it('uses a custom cache key when configured', function () {
|
||||
config(['mcp.cache.for_agents_key' => 'custom-module.for-agents.json']);
|
||||
|
||||
$controller = new ForAgentsController();
|
||||
$controller = new ForAgentsController;
|
||||
|
||||
expect($controller->cacheKey())->toBe('custom-module.for-agents.json');
|
||||
});
|
||||
|
|
@ -34,7 +34,7 @@ describe('ForAgentsController cache key', function () {
|
|||
it('returns to default key after config is cleared', function () {
|
||||
config(['mcp.cache.for_agents_key' => null]);
|
||||
|
||||
$controller = new ForAgentsController();
|
||||
$controller = new ForAgentsController;
|
||||
|
||||
expect($controller->cacheKey())->toBe('agentic.for-agents.json');
|
||||
});
|
||||
|
|
@ -48,7 +48,7 @@ describe('ForAgentsController cache behaviour', function () {
|
|||
it('stores data under the namespaced cache key', function () {
|
||||
Cache::fake();
|
||||
|
||||
$controller = new ForAgentsController();
|
||||
$controller = new ForAgentsController;
|
||||
$controller();
|
||||
|
||||
$key = $controller->cacheKey();
|
||||
|
|
@ -58,7 +58,7 @@ describe('ForAgentsController cache behaviour', function () {
|
|||
it('returns cached data on subsequent calls', function () {
|
||||
Cache::fake();
|
||||
|
||||
$controller = new ForAgentsController();
|
||||
$controller = new ForAgentsController;
|
||||
$first = $controller();
|
||||
$second = $controller();
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ describe('ForAgentsController cache behaviour', function () {
|
|||
config(['mcp.cache.for_agents_ttl' => 7200]);
|
||||
Cache::fake();
|
||||
|
||||
$controller = new ForAgentsController();
|
||||
$controller = new ForAgentsController;
|
||||
$response = $controller();
|
||||
|
||||
expect($response->headers->get('Cache-Control'))->toContain('max-age=7200');
|
||||
|
|
@ -79,7 +79,7 @@ describe('ForAgentsController cache behaviour', function () {
|
|||
config(['mcp.cache.for_agents_ttl' => null]);
|
||||
Cache::fake();
|
||||
|
||||
$controller = new ForAgentsController();
|
||||
$controller = new ForAgentsController;
|
||||
$response = $controller();
|
||||
|
||||
expect($response->headers->get('Cache-Control'))->toContain('max-age=3600');
|
||||
|
|
@ -88,7 +88,7 @@ describe('ForAgentsController cache behaviour', function () {
|
|||
it('can be invalidated using the namespaced key', function () {
|
||||
Cache::fake();
|
||||
|
||||
$controller = new ForAgentsController();
|
||||
$controller = new ForAgentsController;
|
||||
$controller();
|
||||
|
||||
$key = $controller->cacheKey();
|
||||
|
|
@ -102,7 +102,7 @@ describe('ForAgentsController cache behaviour', function () {
|
|||
config(['mcp.cache.for_agents_key' => 'tenant-a.for-agents.json']);
|
||||
Cache::fake();
|
||||
|
||||
$controller = new ForAgentsController();
|
||||
$controller = new ForAgentsController;
|
||||
$controller();
|
||||
|
||||
expect(Cache::has('tenant-a.for-agents.json'))->toBeTrue();
|
||||
|
|
@ -118,7 +118,7 @@ describe('ForAgentsController response', function () {
|
|||
it('returns a JSON response', function () {
|
||||
Cache::fake();
|
||||
|
||||
$controller = new ForAgentsController();
|
||||
$controller = new ForAgentsController;
|
||||
$response = $controller();
|
||||
|
||||
expect($response->headers->get('Content-Type'))->toContain('application/json');
|
||||
|
|
@ -127,7 +127,7 @@ describe('ForAgentsController response', function () {
|
|||
it('response contains platform information', function () {
|
||||
Cache::fake();
|
||||
|
||||
$controller = new ForAgentsController();
|
||||
$controller = new ForAgentsController;
|
||||
$response = $controller();
|
||||
$data = json_decode($response->getContent(), true);
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ describe('ForAgentsController response', function () {
|
|||
it('response contains capabilities', function () {
|
||||
Cache::fake();
|
||||
|
||||
$controller = new ForAgentsController();
|
||||
$controller = new ForAgentsController;
|
||||
$response = $controller();
|
||||
$data = json_decode($response->getContent(), true);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,19 +21,19 @@ use Illuminate\Support\Facades\Queue;
|
|||
|
||||
describe('job configuration', function () {
|
||||
it('has a 600 second timeout', function () {
|
||||
$job = new BatchContentGeneration();
|
||||
$job = new BatchContentGeneration;
|
||||
|
||||
expect($job->timeout)->toBe(600);
|
||||
});
|
||||
|
||||
it('defaults to normal priority', function () {
|
||||
$job = new BatchContentGeneration();
|
||||
$job = new BatchContentGeneration;
|
||||
|
||||
expect($job->priority)->toBe('normal');
|
||||
});
|
||||
|
||||
it('defaults to a batch size of 10', function () {
|
||||
$job = new BatchContentGeneration();
|
||||
$job = new BatchContentGeneration;
|
||||
|
||||
expect($job->batchSize)->toBe(10);
|
||||
});
|
||||
|
|
@ -58,7 +58,7 @@ describe('job configuration', function () {
|
|||
});
|
||||
|
||||
it('implements ShouldQueue', function () {
|
||||
$job = new BatchContentGeneration();
|
||||
$job = new BatchContentGeneration;
|
||||
|
||||
expect($job)->toBeInstanceOf(\Illuminate\Contracts\Queue\ShouldQueue::class);
|
||||
});
|
||||
|
|
@ -113,7 +113,7 @@ describe('queue assignment', function () {
|
|||
|
||||
describe('tags', function () {
|
||||
it('always includes the batch-generation tag', function () {
|
||||
$job = new BatchContentGeneration();
|
||||
$job = new BatchContentGeneration;
|
||||
|
||||
expect($job->tags())->toContain('batch-generation');
|
||||
});
|
||||
|
|
@ -137,13 +137,13 @@ describe('tags', function () {
|
|||
});
|
||||
|
||||
it('returns exactly two tags', function () {
|
||||
$job = new BatchContentGeneration();
|
||||
$job = new BatchContentGeneration;
|
||||
|
||||
expect($job->tags())->toHaveCount(2);
|
||||
});
|
||||
|
||||
it('returns an array', function () {
|
||||
$job = new BatchContentGeneration();
|
||||
$job = new BatchContentGeneration;
|
||||
|
||||
expect($job->tags())->toBeArray();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ function mockAgenticResponse(array $overrides = []): AgenticResponse
|
|||
*/
|
||||
function mockEntitlementResult(bool $denied = false, string $message = ''): object
|
||||
{
|
||||
return new class($denied, $message) {
|
||||
return new class($denied, $message)
|
||||
{
|
||||
public function __construct(
|
||||
private readonly bool $denied,
|
||||
public readonly string $message,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ use Illuminate\Http\Client\Response;
|
|||
*/
|
||||
function retryService(int $maxRetries = 3, int $baseDelayMs = 1000, int $maxDelayMs = 30000): object
|
||||
{
|
||||
return new class($maxRetries, $baseDelayMs, $maxDelayMs) {
|
||||
return new class($maxRetries, $baseDelayMs, $maxDelayMs)
|
||||
{
|
||||
use HasRetry;
|
||||
|
||||
public array $sleepCalls = [];
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ use Psr\Http\Message\StreamInterface;
|
|||
*/
|
||||
function fakeStream(string $data, int $chunkSize = 8192): StreamInterface
|
||||
{
|
||||
return new class($data, $chunkSize) implements StreamInterface {
|
||||
return new class($data, $chunkSize) implements StreamInterface
|
||||
{
|
||||
private int $pos = 0;
|
||||
|
||||
public function __construct(
|
||||
|
|
@ -47,31 +48,61 @@ function fakeStream(string $data, int $chunkSize = 8192): StreamInterface
|
|||
}
|
||||
|
||||
// --- PSR-7 stubs (not exercised by the trait) ---
|
||||
public function __toString(): string { return $this->data; }
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function close(): void {}
|
||||
|
||||
public function detach() { return null; }
|
||||
public function detach()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getSize(): ?int { return strlen($this->data); }
|
||||
public function getSize(): ?int
|
||||
{
|
||||
return strlen($this->data);
|
||||
}
|
||||
|
||||
public function tell(): int { return $this->pos; }
|
||||
public function tell(): int
|
||||
{
|
||||
return $this->pos;
|
||||
}
|
||||
|
||||
public function isSeekable(): bool { return false; }
|
||||
public function isSeekable(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function seek($offset, $whence = SEEK_SET): void {}
|
||||
|
||||
public function rewind(): void {}
|
||||
|
||||
public function isWritable(): bool { return false; }
|
||||
public function isWritable(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function write($string): int { return 0; }
|
||||
public function write($string): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function isReadable(): bool { return true; }
|
||||
public function isReadable(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getContents(): string { return substr($this->data, $this->pos); }
|
||||
public function getContents(): string
|
||||
{
|
||||
return substr($this->data, $this->pos);
|
||||
}
|
||||
|
||||
public function getMetadata($key = null) { return null; }
|
||||
public function getMetadata($key = null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +111,8 @@ function fakeStream(string $data, int $chunkSize = 8192): StreamInterface
|
|||
*/
|
||||
function streamParsingService(): object
|
||||
{
|
||||
return new class {
|
||||
return new class
|
||||
{
|
||||
use HasStreamParsing;
|
||||
|
||||
public function sse(StreamInterface $stream, callable $extract): Generator
|
||||
|
|
@ -293,7 +325,7 @@ describe('parseSSEStream chunked reads', function () {
|
|||
|
||||
it('processes remaining data buffered after stream EOF', function () {
|
||||
// No trailing newline – data stays in the buffer until EOF
|
||||
$raw = "data: {\"text\":\"buffered\"}";
|
||||
$raw = 'data: {"text":"buffered"}';
|
||||
$service = streamParsingService();
|
||||
|
||||
$results = iterator_to_array(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue