Skip to content

Commit 9b5cda8

Browse files
authored
Merge pull request #66 from oat-sa/feature/TR-5944/upgrade-dependencies
Feature TR-5944 adjust the service configuration to LTI libraries breaking changes in dependency injection
2 parents 71b89e8 + f0524ed commit 9b5cda8

File tree

6 files changed

+71
-83
lines changed

6 files changed

+71
-83
lines changed

.github/workflows/build.yaml

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Build
22

3-
on: push
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
48

59
jobs:
610
build:
@@ -9,42 +13,42 @@ jobs:
913
strategy:
1014
fail-fast: false
1115
matrix:
12-
php: [8.0, 8.1, 8.2]
13-
extra-composer-params: [""]
16+
php: [ 8.0, 8.1, 8.2, 8.3 ]
17+
extra-composer-params: [ "" ]
1418
include:
15-
- php: 8.2
16-
coverage: "true"
19+
- php: 8.3
20+
coverage: "true"
1721

1822
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v2
21-
22-
- name: Setup PHP & Composer
23-
uses: shivammathur/setup-php@v2
24-
with:
25-
php-version: ${{ matrix.php }}
26-
tools: composer:v2
27-
28-
- name: Install dependencies
29-
env:
30-
EXTRA_COMPOSER_PARAMS: ${{ matrix.extra-composer-params }}
31-
run: composer update --no-interaction --no-suggest ${EXTRA_COMPOSER_PARAMS}
32-
33-
- name: PHPUnit
34-
env:
35-
COVERAGE: ${{ matrix.coverage }}
36-
run: |
37-
[ $COVERAGE = "true" ] \
38-
&& mkdir -p build/logs && ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml \
39-
|| ./vendor/bin/phpunit
40-
41-
- name: Psalm
42-
run: |
43-
./vendor/bin/psalm --shepherd
44-
45-
- name: Coveralls
46-
if: ${{ matrix.coverage == 'true' }}
47-
env:
48-
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49-
run: |
50-
./vendor/bin/php-coveralls -v
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
26+
- name: Setup PHP & Composer
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php }}
30+
tools: composer:v2
31+
32+
- name: Install dependencies
33+
env:
34+
EXTRA_COMPOSER_PARAMS: ${{ matrix.extra-composer-params }}
35+
run: composer update --no-interaction --no-suggest ${EXTRA_COMPOSER_PARAMS}
36+
37+
- name: PHPUnit
38+
env:
39+
COVERAGE: ${{ matrix.coverage }}
40+
run: |
41+
[ $COVERAGE = "true" ] \
42+
&& mkdir -p build/logs && ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml \
43+
|| ./vendor/bin/phpunit
44+
45+
- name: Psalm
46+
run: |
47+
./vendor/bin/psalm --shepherd
48+
49+
- name: Coveralls
50+
if: ${{ matrix.coverage == 'true' }}
51+
env:
52+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
run: |
54+
./vendor/bin/php-coveralls -v

Resources/config/services.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ services:
1010

1111
Nyholm\Psr7\Factory\Psr17Factory: ~
1212

13-
Nyholm\Psr7\Factory\HttplugFactory: ~
14-
15-
Http\Message\ResponseFactory:
16-
alias: Nyholm\Psr7\Factory\HttplugFactory
17-
1813
League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface:
1914
class: OAT\Library\Lti1p3Core\Security\OAuth2\Repository\AccessTokenRepository
2015
arguments:

Tests/Resources/Kernel/config/config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ services:
1313
OAT\Bundle\Lti1p3Bundle\Tests\Resources\Service\Server\Handler\TestServiceRequestHandler:
1414
arguments:
1515
- '@security.helper'
16-
- '@Http\Message\ResponseFactory'
1716

1817
# Endpoints
1918
OAT\Bundle\Lti1p3Bundle\Tests\Resources\Action\Platform\Message\TestPlatformMessageAction:

Tests/Resources/Service/Server/Handler/TestServiceRequestHandler.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
namespace OAT\Bundle\Lti1p3Bundle\Tests\Resources\Service\Server\Handler;
2424

2525
use Exception;
26-
use Http\Message\ResponseFactory;
26+
use Nyholm\Psr7\Response;
2727
use OAT\Bundle\Lti1p3Bundle\Security\Authentication\Token\Service\LtiServiceSecurityToken;
2828
use OAT\Library\Lti1p3Core\Security\OAuth2\Validator\Result\RequestAccessTokenValidationResultInterface;
2929
use OAT\Library\Lti1p3Core\Service\Server\Handler\LtiServiceServerRequestHandlerInterface;
@@ -37,13 +37,9 @@ class TestServiceRequestHandler implements LtiServiceServerRequestHandlerInterfa
3737
/** @var Security */
3838
private $security;
3939

40-
/** @var ResponseFactory */
41-
private $factory;
42-
43-
public function __construct(Security $security, ResponseFactory $factory)
40+
public function __construct(Security $security)
4441
{
4542
$this->security = $security;
46-
$this->factory = $factory;
4743
}
4844

4945
public function getServiceName(): string
@@ -110,6 +106,6 @@ public function handleValidatedServiceRequest(
110106
'Content-Length' => strlen($body),
111107
];
112108

113-
return $this->factory->createResponse(200, null, $headers, $body);
109+
return new Response(200, $headers, $body);
114110
}
115111
}

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"require": {
88
"php": ">=8.0.0",
99
"ext-json": "*",
10-
"oat-sa/lib-lti1p3-core": "^6.0",
10+
"league/oauth2-server": "^8.5",
11+
"nyholm/psr7": "^1.8",
12+
"oat-sa/lib-lti1p3-core": "^7.0",
1113
"psr/log": "^1 || ^2 || ^3",
1214
"symfony/framework-bundle": "^5.4",
1315
"symfony/psr-http-message-bridge": "^2.0",
@@ -18,6 +20,8 @@
1820
},
1921
"require-dev": {
2022
"colinodell/psr-testlogger": "^1.2",
23+
"guzzlehttp/guzzle": "^7.8",
24+
"nesbot/carbon": "^2.72",
2125
"php-coveralls/php-coveralls": "^2.4",
2226
"phpunit/phpunit": "~9",
2327
"psalm/plugin-phpunit": "^0.15.1",

phpunit.xml.dist

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,24 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/8.5/phpunit.xsd"
5-
backupGlobals="false"
6-
colors="true"
7-
bootstrap="vendor/autoload.php"
8-
failOnRisky="true"
9-
failOnWarning="true"
10-
>
11-
<php>
12-
<env name="KERNEL_CLASS" value="OAT\Bundle\Lti1p3Bundle\Tests\Resources\Kernel\Lti1p3TestKernel" />
13-
<env name="LTI1P3_SERVICE_ENCRYPTION_KEY" value="someSecretTestKey" />
14-
</php>
15-
16-
<testsuites>
17-
<testsuite name="Lti1p3Bundle Functional Test Suite">
18-
<directory>./Tests/Functional/</directory>
19-
</testsuite>
20-
<testsuite name="Lti1p3Bundle Integration Test Suite">
21-
<directory>./Tests/Integration/</directory>
22-
</testsuite>
23-
</testsuites>
24-
25-
<filter>
26-
<whitelist>
27-
<directory>./</directory>
28-
<exclude>
29-
<directory>./Tests</directory>
30-
<directory>./vendor</directory>
31-
</exclude>
32-
</whitelist>
33-
</filter>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" failOnRisky="true" failOnWarning="true">
3+
<coverage>
4+
<include>
5+
<directory>./</directory>
6+
</include>
7+
<exclude>
8+
<directory>./Tests</directory>
9+
<directory>./vendor</directory>
10+
</exclude>
11+
</coverage>
12+
<php>
13+
<env name="KERNEL_CLASS" value="OAT\Bundle\Lti1p3Bundle\Tests\Resources\Kernel\Lti1p3TestKernel"/>
14+
<env name="LTI1P3_SERVICE_ENCRYPTION_KEY" value="someSecretTestKey"/>
15+
</php>
16+
<testsuites>
17+
<testsuite name="Lti1p3Bundle Functional Test Suite">
18+
<directory>./Tests/Functional/</directory>
19+
</testsuite>
20+
<testsuite name="Lti1p3Bundle Integration Test Suite">
21+
<directory>./Tests/Integration/</directory>
22+
</testsuite>
23+
</testsuites>
3424
</phpunit>

0 commit comments

Comments
 (0)