Skip to content

[WEB-19] Add timeouts - #9

Open
PeterMarynczak wants to merge 2 commits into
masterfrom
feature/WEB-19
Open

[WEB-19] Add timeouts#9
PeterMarynczak wants to merge 2 commits into
masterfrom
feature/WEB-19

Conversation

@PeterMarynczak

Copy link
Copy Markdown

No description provided.

Comment thread docker/config/Dockerfile Outdated
xdebug-2.5.5 \
&& docker-php-ext-enable \
xdebug
RUN pecl install xdebug \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pecl jest awaryjny, lepiej xdebug jako pakiet z distro

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jaką wartość ma ten test?

@PeterMarynczak PeterMarynczak Aug 17, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To jest test utworzony jeszcze przez Meritoo w 2017,
Ten test pokrywa konstruktor, walidację, wartości domyślne i logikę pomocniczą.
Podpiąłem się pod niego bo zaktualizowałem liczbę argumentów z 5 na 7.
Wartość - zabezpiecza przed regresją.

@marcinmdev

Copy link
Copy Markdown

Dlaczego ten PR leci od razu do mastera?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces configurable HTTP connect/request timeouts for the LimeSurvey JSON-RPC client, while also modernizing the project’s tooling and test suite for PHP 8 / PHPUnit 10.

Changes:

  • Add optional connect/request timeout settings to ConnectionConfiguration and apply them in JsonRpcClientManager.
  • Migrate tests to PHPUnit 10 APIs (expectException, MockObject, setUp(): void) and update phpunit.xml.dist.
  • Refresh dev environment/tooling (Docker image, Xdebug config) and raise runtime requirement to PHP >= 8.0.

Reviewed changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/Type/MethodTypeTest.php PHPUnit API migration (setExpectedExceptionexpectException).
tests/Service/SurveyServiceTest.php PHPUnit API migration + mock builder updates; adjusts consecutive-call return values.
tests/Service/ParticipantServiceTest.php PHPUnit API migration, typed setUp(): void, mock builder updates.
tests/Result/ResultTest.php PHPUnit API migration, typed setUp(): void, updated MockObject types.
tests/Result/Processor/ResultProcessorTest.php PHPUnit API migration (expectException).
tests/Result/Item/SurveyTest.php Typed setUp(): void for PHPUnit 10 compatibility.
tests/Result/Item/QuestionTest.php Typed setUp(): void for PHPUnit 10 compatibility.
tests/Result/Item/QuestionShortTest.php Typed setUp(): void for PHPUnit 10 compatibility.
tests/Result/Item/ParticipantTest.php Typed setUp(): void for PHPUnit 10 compatibility.
tests/Result/Item/ParticipantShortTest.php Typed setUp(): void for PHPUnit 10 compatibility.
tests/Result/Collection/SurveysTest.php Typed setUp(): void for PHPUnit 10 compatibility.
tests/Result/Collection/SurveysSummariesTest.php PHPUnit API migration + typed setUp(): void.
tests/Result/Collection/ParticipantsTest.php PHPUnit API migration + typed setUp(): void.
tests/Manager/SessionManagerTest.php PHPUnit API migration + updated mock construction.
tests/Manager/JsonRpcClientManagerTest.php Adds coverage for timeout behavior + PHPUnit 10 mock API updates.
tests/Configuration/ConnectionConfigurationTest.php Updates constructor arity expectations + asserts new timeout getters.
tests/Client/ClientTest.php PHPUnit API migration + updated mock construction + typed setUp(): void.
src/Manager/JsonRpcClientManager.php Applies configured connect/request timeouts to underlying HTTP client.
src/Configuration/ConnectionConfiguration.php Adds new timeout fields, constructor args, and getters.
README.md Documents new timeout constructor arguments and default behavior.
phpunit.xml.dist Updates configuration format/schema for PHPUnit 10.
docker/config/xdebug.ini Updates Xdebug 3 configuration keys.
docker/config/Dockerfile Updates Docker base image and tooling installation approach.
composer.json Raises PHP requirement to >= 8.0 and bumps dev dependencies (incl. PHPUnit 10).
.gitignore Ignores PHPUnit result cache file.
Suppressed comments (1)

tests/Manager/JsonRpcClientManagerTest.php:130

  • This test uses CURLOPT_TIMEOUT, which will fatally error when ext-curl is not installed. Add a curl availability guard and skip when needed.
        static::assertEquals(2, $this->getHttpClientProperty($httpClient, 'timeout'));
        static::assertEquals(7, $this->getHttpClientProperty($httpClient, 'options')[CURLOPT_TIMEOUT]);
    }

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 114 to +119
$this->username = $username;
$this->password = $password;
$this->debugMode = $debugMode;
$this->verifySslCertificate = $verifySslCertificate;
$this->connectTimeout = $connectTimeout;
$this->requestTimeout = $requestTimeout;
Comment on lines +114 to +121
public function testGetRpcClientWithoutTimeoutsDoesNotTouchHttpClientDefaults()
{
$configuration = new ConnectionConfiguration('http://test.com', 'test', 'test');
$httpClient = $this->getHttpClientOfManager(new JsonRpcClientManager($configuration));

static::assertEquals(5, $this->getHttpClientProperty($httpClient, 'timeout'));
static::assertArrayNotHasKey(CURLOPT_TIMEOUT, $this->getHttpClientProperty($httpClient, 'options'));
}
Comment thread docker/config/Dockerfile
Comment on lines +17 to +21
&& cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
&& echo "${TIMEZONE}" > /etc/timezone

RUN set -x \
&& EXT_DIR="$(php -r 'echo PHP_EXTENSION_DIR;')" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do poprawy

Comment on lines +124 to +129
if (null !== $this->connectionConfiguration->getRequestTimeout()) {
$this
->rpcClient
->getHttpClient()
->addOption(CURLOPT_TIMEOUT, $this->connectionConfiguration->getRequestTimeout());
}
@PeterMarynczak

Copy link
Copy Markdown
Author

Dlaczego ten PR leci od razu do mastera?
historycznie all prs tutaj były do mastera. Chciałem wystawić tag po mergu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants