diff --git a/.Jenkinsfile b/.Jenkinsfile new file mode 100644 index 0000000..ef792c6 --- /dev/null +++ b/.Jenkinsfile @@ -0,0 +1,33 @@ +pipeline { + agent { + label 'master' + } + stages { + stage('Tests') { + agent { + docker { + image 'alexwijn/docker-git-php-composer' + reuseNode true + } + } + environment { + HOME = '.' + } + options { + skipDefaultCheckout() + } + steps { + withCredentials([string(credentialsId: 'jenkins_github_token', variable: 'GIT_TOKEN')]) { + sh( + label: 'Install/Update sources from Composer', + script: "COMPOSER_AUTH='{\"github-oauth\": {\"github.com\": \"$GIT_TOKEN\"}}\' composer update --no-interaction --no-ansi --no-progress" + ) + } + sh( + label: 'Run backend tests', + script: './vendor/bin/phpunit' + ) + } + } + } +} diff --git a/README.md b/README.md index bac185a..d579922 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ You can then find below usage tutorials, presented by topics. ### Messages -- how to [implement the proctoring workflow (for platform and / or tool)](doc/message/proctoring-workflow.md) +- how to [implement the proctoring messages workflow (for platform and / or tool)](doc/message/proctoring-workflow.md) ### Services diff --git a/doc/service/tool.md b/doc/service/tool.md index 67adc5d..347fc53 100644 --- a/doc/service/tool.md +++ b/doc/service/tool.md @@ -42,12 +42,13 @@ $control = new AcsControl(...); /** @var AcsControlResultInterface $controlResult */ $controlResult = $acsClient->sendControlForPayload( - $registration, // [required] as the tool, it will call the platform of this registration - $payload, // [required] from the LTI message payload containing the ACS claim (got at LTI launch) - $control // [required] with provided ACS control + $registration, // [required] as the tool, it will call the platform of this registration + $control, // [required] with provided ACS control + $payload // [required] from the LTI message payload containing the ACS claim (got at LTI launch) + ); -// or you also can call directly for an given URL (avoid claim construction) +// or you also can call directly for an given URL (avoid payload construction) /** @var AcsControlResultInterface $controlResult */ $controlResult = $acsClient->sendControl( $registration, // [required] as the tool, it will call the platform of this registration diff --git a/src/Service/Client/AcsServiceClient.php b/src/Service/Client/AcsServiceClient.php index 392175d..92ddef6 100644 --- a/src/Service/Client/AcsServiceClient.php +++ b/src/Service/Client/AcsServiceClient.php @@ -67,8 +67,8 @@ public function __construct( */ public function sendControlForPayload( RegistrationInterface $registration, - LtiMessagePayloadInterface $payload, - AcsControlInterface $control + AcsControlInterface $control, + LtiMessagePayloadInterface $payload ): AcsControlResultInterface { try { $acsClaim = $payload->getAcs(); diff --git a/tests/Integration/Service/Client/AcsServiceClientTest.php b/tests/Integration/Service/Client/AcsServiceClientTest.php index 46334c9..6a7e6db 100644 --- a/tests/Integration/Service/Client/AcsServiceClientTest.php +++ b/tests/Integration/Service/Client/AcsServiceClientTest.php @@ -246,7 +246,7 @@ public function testSendControlForPayloadSuccess(): void ->method('getAcs') ->willReturn($acsClaim); - $result = $this->subject->sendControlForPayload($registration, $payloadMock, $control); + $result = $this->subject->sendControlForPayload($registration, $control, $payloadMock); $this->assertInstanceOf(AcsControlResultInterface::class, $result); $this->assertEquals($controlResult, $result); @@ -271,8 +271,8 @@ public function testSendControlForPayloadFailureOnMissingAcsClaim(): void $this->subject->sendControlForPayload( $registration, - $payloadMock, - $this->createMock(AcsControlInterface::class) + $this->createMock(AcsControlInterface::class), + $payloadMock ); } @@ -306,8 +306,8 @@ public function testSendControlForPayloadFailureOnInvalidAcsAction(): void $this->subject->sendControlForPayload( $registration, - $payloadMock, - $control + $control, + $payloadMock ); } }