mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-02 16:29:32 +00:00
Migrated phpunit annotations to attributes
This commit is contained in:
parent
f1d34bbc24
commit
dc480f755c
50 changed files with 171 additions and 246 deletions
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Services\Attachments;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use App\Services\Formatters\AmountFormatter;
|
||||
use App\Services\Attachments\AttachmentPathResolver;
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
|
|
@ -119,17 +120,13 @@ class AttachmentPathResolverTest extends WebTestCase
|
|||
yield ['/not/root'.$this->footprint_path, null];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider placeholderDataProvider
|
||||
*/
|
||||
#[DataProvider('placeholderDataProvider')]
|
||||
public function testPlaceholderToRealPath($param, $expected): void
|
||||
{
|
||||
$this->assertSame($expected, $this->service->placeholderToRealPath($param));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider realPathDataProvider
|
||||
*/
|
||||
#[DataProvider('realPathDataProvider')]
|
||||
public function testRealPathToPlaceholder($param, $expected, $old_method = false): void
|
||||
{
|
||||
$this->assertSame($expected, $this->service->realPathToPlaceholder($param, $old_method));
|
||||
|
|
@ -154,9 +151,7 @@ class AttachmentPathResolverTest extends WebTestCase
|
|||
yield [$this->footprint_path . '/Passive/Capacitors/CAPACITOR_CTS_A_15MM.png', '%FOOTPRINTS%/Passive/Capacitors/CAPACITOR_CTS_A_15MM.png'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider germanFootprintPathdDataProvider
|
||||
*/
|
||||
#[DataProvider('germanFootprintPathdDataProvider')]
|
||||
public function testConversionOfGermanFootprintPaths(string $expected, string $input): void
|
||||
{
|
||||
$this->assertSame($expected, $this->service->placeholderToRealPath($input));
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Services\Attachments;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use App\Services\Attachments\AttachmentURLGenerator;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
|
|
@ -48,11 +49,11 @@ class AttachmentURLGeneratorTest extends WebTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataProvider
|
||||
*
|
||||
* @param $input
|
||||
* @param $expected
|
||||
*/
|
||||
#[DataProvider('dataProvider')]
|
||||
public function testTestabsolutePathToAssetPath($input, $expected): void
|
||||
{
|
||||
$this->assertSame($expected, static::$service->absolutePathToAssetPath($input, static::PUBLIC_DIR));
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Services\Attachments;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use App\Services\Attachments\BuiltinAttachmentsFinder;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
|
|
@ -54,9 +55,7 @@ class BuiltinAttachmentsFinderTest extends WebTestCase
|
|||
yield ['.txt', [], ['%FOOTPRINTS_3D%/hallo.txt']];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataProvider
|
||||
*/
|
||||
#[DataProvider('dataProvider')]
|
||||
public function testFind($keyword, $options, $expected): void
|
||||
{
|
||||
$value = static::$service->find($keyword, $options, static::$mock_list);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Tests\Services\Attachments;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use App\Services\Attachments\FileTypeFilterTools;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
|
|
@ -85,25 +86,20 @@ class FileTypeFilterToolsTest extends WebTestCase
|
|||
|
||||
/**
|
||||
* Test the validateFilterString method.
|
||||
*
|
||||
* @dataProvider validateDataProvider
|
||||
*/
|
||||
#[DataProvider('validateDataProvider')]
|
||||
public function testValidateFilterString(string $filter, bool $expected): void
|
||||
{
|
||||
$this->assertSame($expected, self::$service->validateFilterString($filter));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider normalizeDataProvider
|
||||
*/
|
||||
#[DataProvider('normalizeDataProvider')]
|
||||
public function testNormalizeFilterString(string $filter, string $expected): void
|
||||
{
|
||||
$this->assertSame($expected, self::$service->normalizeFilterString($filter));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider extensionAllowedDataProvider
|
||||
*/
|
||||
#[DataProvider('extensionAllowedDataProvider')]
|
||||
public function testIsExtensionAllowed(string $filter, string $extension, bool $expected): void
|
||||
{
|
||||
$this->assertSame($expected, self::$service->isExtensionAllowed($filter, $extension));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue