Skip to content

Commit 1af75b2

Browse files
committed
chore: Update LICENSE year and add test for maxage parameter in concurrent requests
- Updated copyright year in LICENSE.md from 2024 to 2026. - Added a new test method `testCandles_automaticConcurrent_withMaxage` in CandlesConcurrentTest.php to verify that the maxage parameter is correctly applied in parallel requests using CACHED mode.
1 parent 30628de commit 1af75b2

2 files changed

Lines changed: 53 additions & 1 deletion

File tree

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Market Data
3+
Copyright (c) 2026 Market Data
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

tests/Unit/Stocks/CandlesConcurrentTest.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,4 +1888,56 @@ public function testCandles_automaticConcurrent_csvFormatEmptyAndFailure(): void
18881888
parameters: new Parameters(format: Format::CSV)
18891889
);
18901890
}
1891+
1892+
/**
1893+
* Test that maxage parameter is passed correctly in parallel requests.
1894+
*
1895+
* This tests UniversalParameters line 216 - the maxage parameter
1896+
* being applied to each parallel request when using CACHED mode.
1897+
*/
1898+
public function testCandles_automaticConcurrent_withMaxage(): void
1899+
{
1900+
// Mock response: FROM real API output (captured on 2026-01-23)
1901+
$response1 = [
1902+
's' => 'ok',
1903+
't' => [1641220200],
1904+
'o' => [177.83],
1905+
'h' => [179.31],
1906+
'l' => [177.71],
1907+
'c' => [178.965],
1908+
'v' => [3342579],
1909+
];
1910+
1911+
// Mock response: FROM real API output (captured on 2026-01-23)
1912+
$response2 = [
1913+
's' => 'ok',
1914+
't' => [1672756200],
1915+
'o' => [130.28],
1916+
'h' => [130.6999],
1917+
'l' => [129.44],
1918+
'c' => [129.84],
1919+
'v' => [3826842],
1920+
];
1921+
1922+
$this->setMockResponses([
1923+
new Response(203, [], json_encode($response1)),
1924+
new Response(203, [], json_encode($response2)),
1925+
]);
1926+
1927+
$result = $this->client->stocks->candles(
1928+
symbol: 'AAPL',
1929+
from: '2022-01-01',
1930+
to: '2023-12-31',
1931+
resolution: '5',
1932+
parameters: new Parameters(
1933+
format: Format::JSON,
1934+
mode: Mode::CACHED,
1935+
maxage: 300 // 5 minutes
1936+
)
1937+
);
1938+
1939+
$this->assertInstanceOf(Candles::class, $result);
1940+
$this->assertEquals('ok', $result->status);
1941+
$this->assertCount(2, $result->candles);
1942+
}
18911943
}

0 commit comments

Comments
 (0)