mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-04 02:05:16 +02:00
Applied rectors phpunit 9 migrations to tests
This commit is contained in:
parent
684334ba22
commit
fcbb1849ec
22 changed files with 162 additions and 187 deletions
|
@ -38,15 +38,13 @@ class AttachmentURLGeneratorTest extends WebTestCase
|
|||
self::$service = self::getContainer()->get(AttachmentURLGenerator::class);
|
||||
}
|
||||
|
||||
public function dataProvider(): array
|
||||
public function dataProvider(): \Iterator
|
||||
{
|
||||
return [
|
||||
['/public/test.jpg', 'test.jpg'],
|
||||
['/public/folder/test.jpg', 'folder/test.jpg'],
|
||||
['/not/public/test.jpg', null],
|
||||
['/public/', ''],
|
||||
['not/absolute/test.jpg', null],
|
||||
];
|
||||
yield ['/public/test.jpg', 'test.jpg'];
|
||||
yield ['/public/folder/test.jpg', 'folder/test.jpg'];
|
||||
yield ['/not/public/test.jpg', null];
|
||||
yield ['/public/', ''];
|
||||
yield ['not/absolute/test.jpg', null];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,20 +43,15 @@ class BuiltinAttachmentsFinderTest extends WebTestCase
|
|||
self::$service = self::getContainer()->get(BuiltinAttachmentsFinder::class);
|
||||
}
|
||||
|
||||
public function dataProvider(): array
|
||||
public function dataProvider(): \Iterator
|
||||
{
|
||||
return [
|
||||
//No value should return empty array
|
||||
['', [], []],
|
||||
['', ['empty_returns_all' => true], static::$mock_list],
|
||||
//Basic search for keyword
|
||||
['test', [], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/test/test.png', '%FOOTPRINTS_3D%/test.jpg']],
|
||||
['%FOOTPRINTS_3D%', [], ['%FOOTPRINTS_3D%/test.jpg', '%FOOTPRINTS_3D%/hallo.txt']],
|
||||
['.txt', [], ['%FOOTPRINTS_3D%/hallo.txt']],
|
||||
//Filter extensions
|
||||
//['test', ['allowed_extensions' => ['jpeg', 'jpg']], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/123.jpeg', '%FOOTPRINTS_3D%/test.jpg']],
|
||||
//['test.jpg', ['allowed_extensions' => ['jpeg', 'jpg']], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS_3D%/test.jpg']]
|
||||
];
|
||||
//No value should return empty array
|
||||
yield ['', [], []];
|
||||
yield ['', ['empty_returns_all' => true], static::$mock_list];
|
||||
//Basic search for keyword
|
||||
yield ['test', [], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/test/test.png', '%FOOTPRINTS_3D%/test.jpg']];
|
||||
yield ['%FOOTPRINTS_3D%', [], ['%FOOTPRINTS_3D%/test.jpg', '%FOOTPRINTS_3D%/hallo.txt']];
|
||||
yield ['.txt', [], ['%FOOTPRINTS_3D%/hallo.txt']];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue