Skip to content

Commit 62686be

Browse files
committed
Migrate phpunit metadata to attributes
1 parent 1d04b3f commit 62686be

4 files changed

Lines changed: 10 additions & 5 deletions

File tree

tests/public/LoginIntegrationTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use CurlHandle;
88
use DOMDocument;
9+
use PHPUnit\Framework\Attributes\DataProvider;
910
use PHPUnit\Framework\TestCase;
1011
use SimpleSAML\Configuration;
1112
use SimpleSAML\TestUtils\BuiltInServer;
@@ -162,10 +163,10 @@ public function testWrongServiceUrl(): void
162163

163164
/**
164165
* Test a valid service URL
165-
* @dataProvider validServiceUrlProvider
166166
* @param string $serviceParam The name of the query parameter to use for the service url
167167
* @param string $ticketParam The name of the query parameter that will contain the ticket
168168
*/
169+
#[DataProvider('validServiceUrlProvider')]
169170
public function testValidServiceUrl(string $serviceParam, string $ticketParam): void
170171
{
171172
$service_url = 'http://host1.domain:1234/path1';

tests/public/UtilsTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace SimpleSAML\Casserver;
1313

14+
use PHPUnit\Framework\Attributes\DataProvider;
1415
use PHPUnit\Framework\TestCase;
1516

1617
require_once dirname(__DIR__, 2) . '/public/utility/urlUtils.php';
@@ -20,8 +21,8 @@ class UtilsTest extends TestCase
2021
/**
2122
* @param string $service the service url to check
2223
* @param bool $allowed is the service url allowed?
23-
* @dataProvider checkServiceURLProvider
2424
*/
25+
#[DataProvider('checkServiceURLProvider')]
2526
public function testCheckServiceURL(string $service, bool $allowed): void
2627
{
2728
$legalServices = [

tests/src/ServiceValidatorTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace SimpleSAML\Casserver;
66

7+
use PHPUnit\Framework\Attributes\DataProvider;
78
use PHPUnit\Framework\TestCase;
89
use SimpleSAML\Configuration;
910
use SimpleSAML\Module\casserver\Cas\ServiceValidator;
@@ -21,8 +22,8 @@ class ServiceValidatorTest extends TestCase
2122
*
2223
* @param string $service The service url to test
2324
* @param array $expectedConfig The expected CAS configuration to use
24-
* @dataProvider overridingDataProvider
2525
*/
26+
#[DataProvider('overridingDataProvider')]
2627
public function testOverridingServiceConfig(string $service, array $expectedConfig): void
2728
{
2829
$casConfig = [
@@ -136,8 +137,8 @@ public function overridingDataProvider(): array
136137
* Test confirming service url matching and per service configuration
137138
* @param string $service the service url to check
138139
* @param bool $allowed is the service url allowed?
139-
* @dataProvider checkServiceURLProvider
140140
*/
141+
#[DataProvider('checkServiceURLProvider')]
141142
public function testCheckServiceURL(string $service, bool $allowed): void
142143
{
143144
$casConfig = [

tests/src/TicketValidatorTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace SimpleSAML\Casserver;
66

7+
use PHPUnit\Framework\Attributes\DataProvider;
78
use PHPUnit\Framework\TestCase;
89
use SimpleSAML\Configuration;
910
use SimpleSAML\Module\casserver\Cas\CasException;
@@ -125,10 +126,10 @@ public function testExpiredTicket(): void
125126
}
126127

127128
/**
128-
* @dataProvider urlSanitizationProvider
129129
* @param string $serviceUrl The service url that will get sanitized
130130
* @param string $expectedSanitzedUrl The expected result
131131
*/
132+
#[DataProvider('urlSanitizationProvider')]
132133
public function testUrlSanitization(string $serviceUrl, string $expectedSanitzedUrl): void
133134
{
134135
$this->assertEquals($expectedSanitzedUrl, TicketValidator::sanitize($serviceUrl));
@@ -159,6 +160,7 @@ public function urlSanitizationProvider(): array
159160

160161
/**
161162
* Create a ticket to use for testing
163+
*
162164
* @param string $serviceUrl The service url for this ticket
163165
* @param int $expiration seconds from now that ticket should expire
164166
* @return array the ticket contents

0 commit comments

Comments
 (0)