Skip to content

Commit

Permalink
Merge pull request #21 from oat-sa/feature/TR-5944/upgrade-dependencies
Browse files Browse the repository at this point in the history
BREAKING CHANGE TR-5944 upgrade dependencies, removing `Http\Message\ResponseFactory` from dependencies
  • Loading branch information
wazelin authored Dec 22, 2023
2 parents df5ecbf + 33454fc commit 9dd5bfa
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 75 deletions.
78 changes: 39 additions & 39 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Build

on: push
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
Expand All @@ -9,44 +13,40 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4]
coverage: ["true"]
php: [ 8.0, 8.1, 8.2, 8.3 ]
coverage: [ "false" ]
include:
- php: 8.0
coverage: "false" # PHPUnit 8.5.14 doesn't support code coverage under PHP 8
- php: 8.1
coverage: "false" # PHPUnit 8.5.14 doesn't support code coverage under PHP 8
- php: 8.2
coverage: "false" # PHPUnit 8.5.14 doesn't support code coverage under PHP 8
- php: 8.0
coverage: "true" # Collecting coverage reports only once

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP & Composer
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2

- name: Install dependencies
run: composer install --no-interaction --no-suggest

- name: PHPUnit
env:
COVERAGE: ${{ matrix.coverage }}
run: |
[ $COVERAGE = "true" ] \
&& mkdir -p build/logs && ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml \
|| ./vendor/bin/phpunit
- name: Psalm
run: |
./vendor/bin/psalm --shepherd
- name: Coveralls
if: ${{ matrix.coverage == 'true' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./vendor/bin/php-coveralls -v
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP & Composer
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2

- name: Install dependencies
run: composer install --no-interaction --no-suggest

- name: PHPUnit
env:
COVERAGE: ${{ matrix.coverage }}
run: |
[ $COVERAGE = "true" ] \
&& mkdir -p build/logs && ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml \
|| ./vendor/bin/phpunit
- name: Psalm
run: |
./vendor/bin/psalm --shepherd
- name: Coveralls
if: ${{ matrix.coverage == 'true' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./vendor/bin/php-coveralls -v
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
"type": "library",
"license": "GPL-2.0-only",
"require": {
"php": ">=7.2.0",
"php": ">=8.0.0",
"ext-json": "*",
"oat-sa/lib-lti1p3-core": "^6.2"
"nesbot/carbon": "^2.72",
"nyholm/psr7": "^1.8",
"oat-sa/lib-lti1p3-core": "^7.0",
"psr/http-message": "^1.1"
},
"require-dev": {
"cache/array-adapter": "^1.1",
"phpunit/phpunit": "8.5.14",
"phpunit/phpunit": "^9.6",
"php-coveralls/php-coveralls": "^2.4",
"vimeo/psalm": "^4.6",
"psalm/plugin-phpunit": "^0.15.1"
"psalm/plugin-phpunit": "^0.15"
},
"autoload": {
"psr-4": {
Expand Down
41 changes: 17 additions & 24 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.5/phpunit.xsd"
backupGlobals="false"
colors="true"
>
<php>
<env name="TEST_KEYS_ROOT_DIR" value="file://vendor/oat-sa/lib-lti1p3-core/tests/Resource/Key/RSA" />
</php>

<testsuites>
<testsuite name="Integration">
<directory>tests/Integration</directory>
</testsuite>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory>src</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" colors="true">
<coverage processUncoveredFiles="true">
<include>
<directory>src</directory>
</include>
</coverage>
<php>
<env name="TEST_KEYS_ROOT_DIR" value="file://vendor/oat-sa/lib-lti1p3-core/tests/Resource/Key/RSA"/>
</php>
<testsuites>
<testsuite name="Integration">
<directory>tests/Integration</directory>
</testsuite>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
</testsuites>
</phpunit>
9 changes: 2 additions & 7 deletions src/Service/Server/Handler/AcsServiceServerRequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

namespace OAT\Library\Lti1p3Proctoring\Service\Server\Handler;

use Http\Message\ResponseFactory;
use Nyholm\Psr7\Factory\HttplugFactory;
use Nyholm\Psr7\Response;
use OAT\Library\Lti1p3Core\Security\OAuth2\Validator\Result\RequestAccessTokenValidationResultInterface;
use OAT\Library\Lti1p3Core\Service\Server\Handler\LtiServiceServerRequestHandlerInterface;
use OAT\Library\Lti1p3Proctoring\Serializer\AcsControlResultSerializer;
Expand All @@ -49,19 +49,14 @@ class AcsServiceServerRequestHandler implements LtiServiceServerRequestHandlerIn
/** @var AcsControlResultSerializerInterface */
private $controlResultSerializer;

/** @var ResponseFactory */
private $factory;

public function __construct(
AcsServiceServerControlProcessorInterface $processor,
?AcsControlSerializerInterface $controlSerializer = null,
?AcsControlResultSerializerInterface $controlResultSerializer = null,
?ResponseFactory $factory = null
) {
$this->processor = $processor;
$this->controlSerializer = $controlSerializer ?? new AcsControlSerializer();
$this->controlResultSerializer = $controlResultSerializer ?? new AcsControlResultSerializer();
$this->factory = $factory ?? new HttplugFactory();
}

public function getServiceName(): string
Expand Down Expand Up @@ -106,6 +101,6 @@ public function handleValidatedServiceRequest(
'Content-Length' => strlen($responseBody),
];

return $this->factory->createResponse(200, null, $responseHeaders, $responseBody);
return new Response(200, $responseHeaders, $responseBody);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ protected function setUp(): void
$this->server = new LtiServiceServer(
$this->validatorMock,
$this->subject,
null,
$this->logger
);
}
Expand Down

0 comments on commit 9dd5bfa

Please sign in to comment.