From 5518a9f0ab99253931fb26277449bc67f019b8cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=C5=BBukowicz?= Date: Mon, 2 Jan 2023 16:32:42 +0100 Subject: [PATCH 1/3] Add missing setSessionId for cache purpose #117 --- .github/workflows/static.yml | 19 +++++++++++++++---- src/GusApi/GusApi.php | 5 +++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index c149806..2882a28 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -9,6 +9,10 @@ jobs: name: Composer validation runs-on: ubuntu-20.04 + strategy: + matrix: + php: [ '8.0', '8.1', '8.2', '8.3' ] + steps: - name: Checkout code uses: actions/checkout@v3 @@ -16,7 +20,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: ${{ matrix.php }} - name: Execute composer validate run: composer validate --strict @@ -25,6 +29,10 @@ jobs: name: PHPCs runs-on: ubuntu-20.04 + strategy: + matrix: + php: [ '8.0', '8.1', '8.2', '8.3' ] + steps: - name: Checkout code uses: actions/checkout@v3 @@ -32,7 +40,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: ${{ matrix.php }} - name: Install Dependencies uses: nick-invision/retry@v1 @@ -44,11 +52,14 @@ jobs: - name: Execute PHPCs run: vendor/bin/phpcs src tests - phpstan: name: PHPStan runs-on: ubuntu-20.04 + strategy: + matrix: + php: [ '8.0', '8.1', '8.2', '8.3' ] + steps: - name: Checkout code uses: actions/checkout@v3 @@ -56,7 +67,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: ${{ matrix.php }} - name: Install Dependencies uses: nick-invision/retry@v1 diff --git a/src/GusApi/GusApi.php b/src/GusApi/GusApi.php index 98857b7..ed5614b 100644 --- a/src/GusApi/GusApi.php +++ b/src/GusApi/GusApi.php @@ -54,6 +54,11 @@ public function getSessionId(): string return $this->sessionId; } + public function setSessionId(string $sessionId): void + { + $this->sessionId = $sessionId; + } + /** * @throws InvalidUserKeyException */ From c9f386e33a42b0a0f70c44628886b78df1336d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=C5=BBukowicz?= Date: Mon, 2 Jan 2023 16:40:44 +0100 Subject: [PATCH 2/3] Add missing setSessionId for cache purpose #117 --- tests/GusApiTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/GusApiTest.php b/tests/GusApiTest.php index 9fc738f..259818a 100644 --- a/tests/GusApiTest.php +++ b/tests/GusApiTest.php @@ -54,6 +54,13 @@ public function testLoginWillSetSessionId(): void self::assertSame('12sessionid21', $this->api->getSessionId()); } + public function testSetSessionIdWillSetSession(): void + { + $this->api->setSessionId("12sessionid21"); + $this->mockApiClientGetValueCall('StatusSesji', '1'); + self::assertTrue($this->api->isLogged()); + } + public function testGetSessionIdFailsWhenNotLoggedIn(): void { $this->expectException(BadMethodCallException::class); @@ -306,6 +313,11 @@ public function testGetSessionStatus(): void private function expectGetValueCall(string $parameter, string $value): void { $this->loginApiWithSessionId('12sessionid21'); + $this->mockApiClientGetValueCall($parameter, $value); + } + + private function mockApiClientGetValueCall(string $parameter, string $value): void + { $this->apiClient ->expects(self::once()) ->method('getValue') From a5304e4d3ca1a2eec4ee6c88411d45884f487b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janusz=20=C5=BBukowicz?= Date: Mon, 2 Jan 2023 16:49:31 +0100 Subject: [PATCH 3/3] Add missing setSessionId for cache purpose #117 --- UPGRADE.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 30dcbb0..35fc2ae 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -17,8 +17,6 @@ GusApi * The `GusApi::setUserKey` has been removed. -* The `GusApi::setSessionId` has been removed. - * The `GusApi::getResultSearchMessage` has been removed. ReportTypes