Skip to content

Commit c17d304

Browse files
committed
Add quick smoketest to assert the routes don't produce an error and the status code is correct
1 parent 52de2e7 commit c17d304

3 files changed

Lines changed: 102 additions & 2 deletions

File tree

ci/qa/phpunit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ XDEBUG_MODE=coverage ./vendor/bin/phpunit --configuration=./tests/phpunit.xml --
1818
echo -e "\nPHPUnit unit tests\n"
1919
XDEBUG_MODE=coverage ./vendor/bin/phpunit --configuration=./tests/phpunit.xml --testsuite=unit --coverage-clover coverage.xml
2020

21-
echo -e "\nPHPUnit API acceptance tests\n"
21+
echo -e "\nPHPUnit acceptance tests\n"
2222
./bin/console cache:clear --env=test --no-warmup
2323
APP_ENV=test XDEBUG_MODE=coverage ./vendor/bin/phpunit --configuration=./tests/phpunit.xml --testsuite=functional --coverage-clover coverage.xml
2424

languages/messages.en.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@
265265
'error_clock_issue_desc' => 'This is likely because the difference in time between %idpName% and %suiteName% it too large. Please verify that the time on the %organisationNoun% is correct.',
266266
'error_clock_issue_desc_no_idp_name' => 'This is likely because the difference in time between %organisationNoun% and %suiteName% it too large. Please verify that the time on the IdP is correct.',
267267
'error_stepup_callout_unknown' => 'Error - Unknown strong authentication failure',
268-
'error_stepup_callout_unknown_desc' => 'Logging in with strong authentication has failed and we don\'t know exactly why . Please try again first by going back to the service and logging in again . If this doesn\'t work, please contact the service desk of your %organisationNoun%.',
268+
'error_stepup_callout_unknown_desc' => 'Logging in with strong authentication has failed and we don\'t know exactly why. Please try again first by going back to the service and logging in again. If this doesn\'t work, please contact the service desk of your %organisationNoun%.',
269269
'error_stepup_callout_unmet_loa_title' => 'Error - No suitable token found',
270270
'error_stepup_callout_unmet_loa_desc' => 'To continue to this service, a registered token with a certain level of assurance is required. Currently, you either haven\'t registered a token at all, or the level of assurance of the token you did register is too low. See the link below for more information about the registration process.',
271271
'error_stepup_callout_unmet_loa_link_text' => 'Read more about the registration process.',
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<?php
2+
3+
/**
4+
* Copyright 2026 SURFnet B.V.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
namespace OpenConext\EngineBlockBundle\Tests;
20+
21+
use PHPUnit\Framework\Attributes\Test;
22+
use Symfony\Component\HttpFoundation\Response;
23+
24+
final class FeedbackControllerTest extends FunctionalWebTestCase
25+
{
26+
#[Test]
27+
public function session_lost_returns_400_with_expected_content(): void
28+
{
29+
$this->assertFeedbackPage('/authentication/feedback/session-lost', Response::HTTP_BAD_REQUEST, 'your session was lost');
30+
}
31+
32+
#[Test]
33+
public function session_not_started_returns_400_with_expected_content(): void
34+
{
35+
$this->assertFeedbackPage('/authentication/feedback/session-not-started', Response::HTTP_BAD_REQUEST, 'No session found');
36+
}
37+
38+
#[Test]
39+
public function unsolicited_response_returns_400_with_expected_content(): void
40+
{
41+
$this->assertFeedbackPage('/authentication/feedback/unsolicited-response', Response::HTTP_BAD_REQUEST, 'Sign-in could not be completed');
42+
}
43+
44+
#[Test]
45+
public function invalid_acs_binding_returns_400_with_expected_content(): void
46+
{
47+
$this->assertFeedbackPage('/authentication/feedback/invalid-acs-binding', Response::HTTP_BAD_REQUEST, 'Invalid ACS binding type');
48+
}
49+
50+
#[Test]
51+
public function received_error_status_code_returns_400_with_expected_content(): void
52+
{
53+
$this->assertFeedbackPage('/authentication/feedback/received-error-status-code', Response::HTTP_BAD_REQUEST, 'Identity Provider error');
54+
}
55+
56+
#[Test]
57+
public function unable_to_receive_message_returns_400_with_expected_content(): void
58+
{
59+
$this->assertFeedbackPage('/authentication/feedback/unable-to-receive-message', Response::HTTP_BAD_REQUEST, 'No message received');
60+
}
61+
62+
#[Test]
63+
public function unknown_requesterid_in_authnrequest_returns_400_with_expected_content(): void
64+
{
65+
$this->assertFeedbackPage('/authentication/feedback/unknown_requesterid_in_authnrequest', Response::HTTP_BAD_REQUEST, 'Unknown service');
66+
}
67+
68+
#[Test]
69+
public function authentication_limit_exceeded_returns_429_with_expected_content(): void
70+
{
71+
$this->assertFeedbackPage('/authentication/feedback/authentication-limit-exceeded', Response::HTTP_TOO_MANY_REQUESTS, 'too many authentications in progress');
72+
}
73+
74+
#[Test]
75+
public function stepup_callout_unknown_returns_400_with_expected_content(): void
76+
{
77+
$this->assertFeedbackPage('/authentication/feedback/stepup-callout-unknown', Response::HTTP_BAD_REQUEST, 'Unknown strong authentication failure');
78+
}
79+
80+
#[Test]
81+
public function stepup_callout_user_cancelled_returns_400_with_expected_content(): void
82+
{
83+
$this->assertFeedbackPage('/authentication/feedback/stepup-callout-user-cancelled', Response::HTTP_BAD_REQUEST, 'Logging in cancelled');
84+
}
85+
86+
#[Test]
87+
public function invalid_acs_location_returns_400_with_expected_content(): void
88+
{
89+
$this->assertFeedbackPage('/authentication/feedback/invalidAcsLocation', Response::HTTP_BAD_REQUEST, 'Invalid ACS location');
90+
}
91+
92+
private function assertFeedbackPage(string $path, int $expectedStatus, string $expectedPhrase): void
93+
{
94+
$client = self::createClient();
95+
$client->request('GET', 'https://engine.dev.openconext.local' . $path);
96+
97+
$this->assertEquals($expectedStatus, $client->getResponse()->getStatusCode());
98+
$this->assertStringContainsString($expectedPhrase, $client->getResponse()->getContent());
99+
}
100+
}

0 commit comments

Comments
 (0)