From 3049c6322c67bf3008cd44c5a4ca15756cd32db5 Mon Sep 17 00:00:00 2001 From: Daniel Jakob Date: Wed, 17 Sep 2025 07:57:55 +0200 Subject: [PATCH] Add new JobState struct Also add php 8.4 to the buildmatrix --- .github/workflows/php.yml | 8 ++-- src/Struct/Generic/JobState.php | 50 ++++++++++++++++++++++++ src/Struct/Generic/JobStateInterface.php | 28 +++++++++++++ tests/Struct/Generic/JobStateTest.php | 36 +++++++++++++++++ 4 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 src/Struct/Generic/JobState.php create mode 100644 src/Struct/Generic/JobStateInterface.php create mode 100644 tests/Struct/Generic/JobStateTest.php diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 3d4624e..aefc3aa 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -12,8 +12,8 @@ jobs: strategy: matrix: os: ['ubuntu-latest'] - php: ['8.2', '8.3'] - continue-on-error: ${{ matrix.php == '8.3' }} + php: ['8.2', '8.3', '8.4'] + continue-on-error: ${{ matrix.php == '8.4' }} steps: - uses: actions/checkout@v2 @@ -27,7 +27,7 @@ jobs: run: composer validate - name: Install dependencies - if: ${{ matrix.php != '8.3' }} + if: ${{ matrix.php != '8.4' }} uses: nick-invision/retry@v1 with: timeout_minutes: 5 @@ -35,7 +35,7 @@ jobs: command: composer update --no-interaction --no-progress - name: Install Dependencies (ignore platform) - if: ${{ matrix.php == '8.3' }} + if: ${{ matrix.php == '8.4' }} uses: nick-invision/retry@v1 with: timeout_minutes: 5 diff --git a/src/Struct/Generic/JobState.php b/src/Struct/Generic/JobState.php new file mode 100644 index 0000000..674c0f9 --- /dev/null +++ b/src/Struct/Generic/JobState.php @@ -0,0 +1,50 @@ +id = $id; + $this->status = $status; + $this->statusDescription = $statusDescription; + } + + /** @inheritDoc */ + public function getId(): string + { + return $this->id; + } + + /** @inheritDoc */ + public function getStatus(): int + { + return $this->status; + } + + /** @inheritDoc */ + public function getStatusDescription(): string + { + return $this->statusDescription; + } +} diff --git a/src/Struct/Generic/JobStateInterface.php b/src/Struct/Generic/JobStateInterface.php new file mode 100644 index 0000000..e11439b --- /dev/null +++ b/src/Struct/Generic/JobStateInterface.php @@ -0,0 +1,28 @@ +subject = new JobState( + 'some id', + 4, + 'some description', + ); + } + + public function testGetIdCanReturnString(): void + { + self::assertSame('some id', $this->subject->getId()); + } + + public function testGetStatusCanReturnInt(): void + { + self::assertSame(4, $this->subject->getStatus()); + } + + public function testGetStatusDescriptionCanReturnString(): void + { + self::assertSame('some description', $this->subject->getStatusDescription()); + } +}