CS fixes in tests

This commit is contained in:
Aleksander Machniak
2025-07-07 17:55:52 +02:00
parent 199f203e83
commit ba60aa8637

View File

@@ -10,22 +10,10 @@ use Roundcube\Tests\ServerTestCase;
*/
class StaticTest extends ServerTestCase
{
/**
* Dataset for testExistingResources()
*/
public static function provideExistingResources(): iterable
{
return [
['program/resources/blank.gif', 'image/gif'],
['skins/elastic/images/logo.svg?s=1234567', 'image/svg+xml'],
['plugins/acl/acl.js', 'text/javascript'],
];
}
/**
* Test valid resources
*/
#[DataProvider('provideExistingResources')]
#[DataProvider('provide_ExistingResources_cases')]
public function testExistingResources($path, $ctype): void
{
$response = $this->request('GET', 'static.php/' . $path);
@@ -41,10 +29,34 @@ class StaticTest extends ServerTestCase
// TODO: Expires and Last-Modified header
}
/**
* Dataset for testExistingResources()
*/
public static function provide_ExistingResources_cases(): iterable
{
return [
['program/resources/blank.gif', 'image/gif'],
['skins/elastic/images/logo.svg?s=1234567', 'image/svg+xml'],
['plugins/acl/acl.js', 'text/javascript'],
];
}
/**
* Test forbidden resources
*/
#[DataProvider('provide_ForbiddenResources_cases')]
public function testForbiddenResources($path): void
{
$response = $this->request('GET', 'static.php/' . $path);
$this->assertSame(404, $response->getStatusCode());
$this->assertSame('', (string) $response->getBody());
}
/**
* Dataset for testForbiddenResources()
*/
public static function provideForbiddenResources(): iterable
public static function provide_ForbiddenResources_cases(): iterable
{
return [
[''],
@@ -60,18 +72,6 @@ class StaticTest extends ServerTestCase
];
}
/**
* Test forbidden resources
*/
#[DataProvider('provideForbiddenResources')]
public function testForbiddenResources($path): void
{
$response = $this->request('GET', 'static.php/' . $path);
$this->assertSame(404, $response->getStatusCode());
$this->assertSame('', (string) $response->getBody());
}
/**
* Test handling of Modified-Since header
*/