Fixed tests for new PHPunit 11.5
Some checks failed
Build assets artifact / Build assets artifact (push) Has been cancelled
Docker Image Build / docker (push) Has been cancelled
Docker Image Build (FrankenPHP) / docker (push) Has been cancelled
Static analysis / Static analysis (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.1, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, mysql) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, sqlite) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, sqlite) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, sqlite) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.1, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.2, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.3, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.4, postgres) (push) Has been cancelled
PHPUnit Tests / PHPUnit and coverage Test (PHP 8.1, sqlite) (push) Has been cancelled

This commit is contained in:
Jan Böhmer 2025-07-14 21:57:27 +02:00
parent f3ad3c1ffe
commit e2735823a0
44 changed files with 91 additions and 94 deletions

View file

@ -19,10 +19,7 @@
<ini name="memory_limit" value="1G"/> <ini name="memory_limit" value="1G"/>
<ini name="display_errors" value="1"/> <ini name="display_errors" value="1"/>
</php> </php>
<coverage processUncoveredFiles="true"> <coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage> </coverage>
<testsuites> <testsuites>

View file

@ -53,7 +53,7 @@ class ApplicationAvailabilityFunctionalTest extends WebTestCase
$this->assertTrue($client->getResponse()->isSuccessful(), 'Request not successful. Status code is '.$client->getResponse()->getStatusCode() . ' for URL '.$url); $this->assertTrue($client->getResponse()->isSuccessful(), 'Request not successful. Status code is '.$client->getResponse()->getStatusCode() . ' for URL '.$url);
} }
public function urlProvider(): ?Generator public static function urlProvider(): ?Generator
{ {
//Homepage //Homepage
yield ['/']; yield ['/'];

View file

@ -29,12 +29,12 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
#[Group('slow')] #[Group('slow')]
#[Group('DB')] #[Group('DB')]
abstract class AbstractAdminControllerTest extends WebTestCase abstract class AbstractAdminController extends WebTestCase
{ {
protected static string $base_path = 'not_valid'; protected static string $base_path = 'not_valid';
protected static string $entity_class = 'not valid'; protected static string $entity_class = 'not valid';
public function readDataProvider(): \Iterator public static function readDataProvider(): \Iterator
{ {
yield ['noread', false]; yield ['noread', false];
yield ['anonymous', true]; yield ['anonymous', true];
@ -99,7 +99,7 @@ abstract class AbstractAdminControllerTest extends WebTestCase
$this->assertSame($read, !$client->getResponse()->isForbidden(), 'Permission Checking not working!'); $this->assertSame($read, !$client->getResponse()->isForbidden(), 'Permission Checking not working!');
} }
public function deleteDataProvider(): \Iterator public static function deleteDataProvider(): \Iterator
{ {
yield ['noread', false]; yield ['noread', false];
yield ['anonymous', false]; yield ['anonymous', false];

View file

@ -27,7 +27,7 @@ use App\Entity\Attachments\AttachmentType;
#[Group('slow')] #[Group('slow')]
#[Group('DB')] #[Group('DB')]
class AttachmentTypeControllerTest extends AbstractAdminControllerTest class AttachmentTypeController extends AbstractAdminController
{ {
protected static string $base_path = '/en/attachment_type'; protected static string $base_path = '/en/attachment_type';
protected static string $entity_class = AttachmentType::class; protected static string $entity_class = AttachmentType::class;

View file

@ -27,7 +27,7 @@ use App\Entity\Parts\Category;
#[Group('slow')] #[Group('slow')]
#[Group('DB')] #[Group('DB')]
class CategoryControllerTest extends AbstractAdminControllerTest class CategoryController extends AbstractAdminController
{ {
protected static string $base_path = '/en/category'; protected static string $base_path = '/en/category';
protected static string $entity_class = Category::class; protected static string $entity_class = Category::class;

View file

@ -27,7 +27,7 @@ use App\Entity\Parts\Footprint;
#[Group('slow')] #[Group('slow')]
#[Group('DB')] #[Group('DB')]
class FootprintControllerTest extends AbstractAdminControllerTest class FootprintController extends AbstractAdminController
{ {
protected static string $base_path = '/en/footprint'; protected static string $base_path = '/en/footprint';
protected static string $entity_class = Footprint::class; protected static string $entity_class = Footprint::class;

View file

@ -46,7 +46,7 @@ use PHPUnit\Framework\Attributes\Group;
use App\Entity\LabelSystem\LabelProfile; use App\Entity\LabelSystem\LabelProfile;
use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccessDeniedException;
class LabelProfileControllerTest extends AbstractAdminControllerTest class LabelProfileController extends AbstractAdminController
{ {
protected static string $base_path = '/en/label_profile'; protected static string $base_path = '/en/label_profile';
protected static string $entity_class = LabelProfile::class; protected static string $entity_class = LabelProfile::class;

View file

@ -27,7 +27,7 @@ use App\Entity\Parts\Manufacturer;
#[Group('slow')] #[Group('slow')]
#[Group('DB')] #[Group('DB')]
class ManufacturerControllerTest extends AbstractAdminControllerTest class ManufacturerController extends AbstractAdminController
{ {
protected static string $base_path = '/en/manufacturer'; protected static string $base_path = '/en/manufacturer';
protected static string $entity_class = Manufacturer::class; protected static string $entity_class = Manufacturer::class;

View file

@ -27,7 +27,7 @@ use App\Entity\Parts\MeasurementUnit;
#[Group('slow')] #[Group('slow')]
#[Group('DB')] #[Group('DB')]
class MeasurementUnitControllerTest extends AbstractAdminControllerTest class MeasurementUnitController extends AbstractAdminController
{ {
protected static string $base_path = '/en/measurement_unit'; protected static string $base_path = '/en/measurement_unit';
protected static string $entity_class = MeasurementUnit::class; protected static string $entity_class = MeasurementUnit::class;

View file

@ -28,7 +28,7 @@ use App\Entity\ProjectSystem\Project;
#[Group('slow')] #[Group('slow')]
#[Group('DB')] #[Group('DB')]
class ProjectControllerTest extends AbstractAdminControllerTest class ProjectController extends AbstractAdminController
{ {
protected static string $base_path = '/en/project'; protected static string $base_path = '/en/project';
protected static string $entity_class = Project::class; protected static string $entity_class = Project::class;

View file

@ -27,7 +27,7 @@ use App\Entity\Parts\StorageLocation;
#[Group('slow')] #[Group('slow')]
#[Group('DB')] #[Group('DB')]
class StorelocationControllerTest extends AbstractAdminControllerTest class StorelocationController extends AbstractAdminController
{ {
protected static string $base_path = '/en/store_location'; protected static string $base_path = '/en/store_location';
protected static string $entity_class = StorageLocation::class; protected static string $entity_class = StorageLocation::class;

View file

@ -27,7 +27,7 @@ use App\Entity\Parts\Supplier;
#[Group('slow')] #[Group('slow')]
#[Group('DB')] #[Group('DB')]
class SupplierControllerTest extends AbstractAdminControllerTest class SupplierController extends AbstractAdminController
{ {
protected static string $base_path = '/en/supplier'; protected static string $base_path = '/en/supplier';
protected static string $entity_class = Supplier::class; protected static string $entity_class = Supplier::class;

View file

@ -51,7 +51,7 @@ class RedirectControllerTest extends WebTestCase
$this->userRepo = $this->em->getRepository(User::class); $this->userRepo = $this->em->getRepository(User::class);
} }
public function urlMatchDataProvider(): \Iterator public static function urlMatchDataProvider(): \Iterator
{ {
yield ['/', true]; yield ['/', true];
yield ['/part/2/info', true]; yield ['/part/2/info', true];
@ -79,7 +79,7 @@ class RedirectControllerTest extends WebTestCase
$this->assertSame($expect_redirect, $response->isRedirect()); $this->assertSame($expect_redirect, $response->isRedirect());
} }
public function urlAddLocaleDataProvider(): \Iterator public static function urlAddLocaleDataProvider(): \Iterator
{ {
//User locale, original target, redirect target //User locale, original target, redirect target
yield ['de', '/', '/de/']; yield ['de', '/', '/de/'];

View file

@ -41,7 +41,7 @@ class FilterTraitTest extends TestCase
$this->assertFalse($this->useHaving); $this->assertFalse($this->useHaving);
} }
public function isAggregateFunctionStringDataProvider(): iterable public static function isAggregateFunctionStringDataProvider(): iterable
{ {
yield [false, 'parts.test']; yield [false, 'parts.test'];
yield [false, 'attachments.test']; yield [false, 'attachments.test'];

View file

@ -79,7 +79,7 @@ class DatatablesAvailabilityTest extends WebTestCase
$this->assertJson($client->getResponse()->getContent()); $this->assertJson($client->getResponse()->getContent());
} }
public function urlProvider(): ?\Generator public static function urlProvider(): ?\Generator
{ {
//Part lists //Part lists
yield ['/category/1/parts']; yield ['/category/1/parts'];

View file

@ -29,7 +29,7 @@ use PHPUnit\Framework\TestCase;
class SQLiteRegexMiddlewareTest extends TestCase class SQLiteRegexMiddlewareTest extends TestCase
{ {
public function regexpDataProvider(): \Generator public static function regexpDataProvider(): \Generator
{ {
yield [1, 'a', 'a']; yield [1, 'a', 'a'];
yield [0, 'a', 'b']; yield [0, 'a', 'b'];
@ -48,7 +48,7 @@ class SQLiteRegexMiddlewareTest extends TestCase
$this->assertSame($expected, SQLiteRegexExtensionMiddlewareDriver::regexp($pattern, $value)); $this->assertSame($expected, SQLiteRegexExtensionMiddlewareDriver::regexp($pattern, $value));
} }
public function fieldDataProvider(): \Generator public static function fieldDataProvider(): \Generator
{ {
// Null cases // Null cases

View file

@ -75,7 +75,7 @@ class AttachmentTest extends TestCase
$this->assertEmpty($attachment->getFilename()); $this->assertEmpty($attachment->getFilename());
} }
public function subClassesDataProvider(): \Iterator public static function subClassesDataProvider(): \Iterator
{ {
yield [AttachmentTypeAttachment::class, AttachmentType::class]; yield [AttachmentTypeAttachment::class, AttachmentType::class];
yield [CategoryAttachment::class, Category::class]; yield [CategoryAttachment::class, Category::class];

View file

@ -47,7 +47,7 @@ use PHPUnit\Framework\TestCase;
class PartParameterTest extends TestCase class PartParameterTest extends TestCase
{ {
public function valueWithUnitDataProvider(): \Iterator public static function valueWithUnitDataProvider(): \Iterator
{ {
yield ['1', 1.0, '']; yield ['1', 1.0, ''];
yield ['1 V', 1.0, 'V']; yield ['1 V', 1.0, 'V'];
@ -55,7 +55,7 @@ class PartParameterTest extends TestCase
yield ['1.23 V', 1.23, 'V']; yield ['1.23 V', 1.23, 'V'];
} }
public function formattedValueDataProvider(): \Iterator public static function formattedValueDataProvider(): \Iterator
{ {
yield ['Text Test', null, null, null, 'V', 'Text Test']; yield ['Text Test', null, null, null, 'V', 'Text Test'];
yield ['10.23 V', null, 10.23, null, 'V', '']; yield ['10.23 V', null, 10.23, null, 'V', ''];
@ -68,7 +68,7 @@ class PartParameterTest extends TestCase
yield ['10.23 V (9 V ... 11 V) [Test]', 9, 10.23, 11, 'V', 'Test']; yield ['10.23 V (9 V ... 11 V) [Test]', 9, 10.23, 11, 'V', 'Test'];
} }
public function formattedValueWithLatexDataProvider(): \Iterator public static function formattedValueWithLatexDataProvider(): \Iterator
{ {
yield ['Text Test', null, null, null, 'V', 'Text Test']; yield ['Text Test', null, null, null, 'V', 'Text Test'];
yield ['10.23 $\mathrm{V}$', null, 10.23, null, 'V', '']; yield ['10.23 $\mathrm{V}$', null, 10.23, null, 'V', ''];

View file

@ -47,7 +47,7 @@ class UserTest extends TestCase
$this->assertSame('John (@username)', $user->getFullName(true)); $this->assertSame('John (@username)', $user->getFullName(true));
} }
public function googleAuthenticatorEnabledDataProvider(): \Iterator public static function googleAuthenticatorEnabledDataProvider(): \Iterator
{ {
yield [null, false]; yield [null, false];
yield ['', false]; yield ['', false];
@ -62,7 +62,7 @@ class UserTest extends TestCase
$this->assertSame($expected, $user->isGoogleAuthenticatorEnabled()); $this->assertSame($expected, $user->isGoogleAuthenticatorEnabled());
} }
#[RequiresPhpunit('8')] //#[RequiresPhpunit('8')]
public function testSetBackupCodes(): void public function testSetBackupCodes(): void
{ {
$user = new User(); $user = new User();

View file

@ -35,7 +35,7 @@ class BBCodeToMarkdownConverterTest extends TestCase
$this->converter = new BBCodeToMarkdownConverter(); $this->converter = new BBCodeToMarkdownConverter();
} }
public function dataProvider(): \Iterator public static function dataProvider(): \Iterator
{ {
yield ['[b]Bold[/b]', '**Bold**']; yield ['[b]Bold[/b]', '**Bold**'];
yield ['[i]Italic[/i]', '*Italic*']; yield ['[i]Italic[/i]', '*Italic*'];

View file

@ -29,7 +29,7 @@ use PHPUnit\Framework\TestCase;
class IPAnonymizerTest extends TestCase class IPAnonymizerTest extends TestCase
{ {
public function anonymizeDataProvider(): \Generator public static function anonymizeDataProvider(): \Generator
{ {
yield ['127.0.0.0', '127.0.0.23']; yield ['127.0.0.0', '127.0.0.23'];
yield ['2001:db8:85a3::', '2001:0db8:85a3:0000:0000:8a2e:0370:7334']; yield ['2001:db8:85a3::', '2001:0db8:85a3:0000:0000:8a2e:0370:7334'];

View file

@ -70,19 +70,19 @@ class AttachmentPathResolverTest extends WebTestCase
$this->assertNull($this->service->parameterToAbsolutePath('/./this/one/too')); $this->assertNull($this->service->parameterToAbsolutePath('/./this/one/too'));
} }
public function placeholderDataProvider(): \Iterator public static function placeholderDataProvider(): \Iterator
{ {
//We need to do initialization (again), as dataprovider is called before setUp() //We need to do initialization (again), as dataprovider is called before setUp()
self::bootKernel(); self::bootKernel();
$this->projectDir_orig = realpath(self::$kernel->getProjectDir()); $projectDir_orig = realpath(self::$kernel->getProjectDir());
$this->projectDir = str_replace('\\', '/', $this->projectDir_orig); $projectDir = str_replace('\\', '/', $projectDir_orig);
$this->media_path = $this->projectDir.'/public/media'; $media_path = $projectDir.'/public/media';
$this->footprint_path = $this->projectDir.'/public/img/footprints'; $footprint_path = $projectDir.'/public/img/footprints';
yield ['%FOOTPRINTS%/test/test.jpg', $this->footprint_path.'/test/test.jpg']; yield ['%FOOTPRINTS%/test/test.jpg', $footprint_path.'/test/test.jpg'];
yield ['%FOOTPRINTS%/test/', $this->footprint_path.'/test/']; yield ['%FOOTPRINTS%/test/', $footprint_path.'/test/'];
yield ['%MEDIA%/test', $this->media_path.'/test']; yield ['%MEDIA%/test', $media_path.'/test'];
yield ['%MEDIA%', $this->media_path]; yield ['%MEDIA%', $media_path];
yield ['%FOOTPRINTS%', $this->footprint_path]; yield ['%FOOTPRINTS%', $footprint_path];
//Footprints 3D are disabled //Footprints 3D are disabled
yield ['%FOOTPRINTS_3D%', null]; yield ['%FOOTPRINTS_3D%', null];
//Check that invalid pathes return null //Check that invalid pathes return null
@ -99,25 +99,25 @@ class AttachmentPathResolverTest extends WebTestCase
yield ['%FOOTPRINTS%/0\..\test', null]; yield ['%FOOTPRINTS%/0\..\test', null];
} }
public function realPathDataProvider(): \Iterator public static function realPathDataProvider(): \Iterator
{ {
//We need to do initialization (again), as dataprovider is called before setUp() //We need to do initialization (again), as dataprovider is called before setUp()
self::bootKernel(); self::bootKernel();
$this->projectDir_orig = realpath(self::$kernel->getProjectDir()); $projectDir_orig = realpath(self::$kernel->getProjectDir());
$this->projectDir = str_replace('\\', '/', $this->projectDir_orig); $projectDir = str_replace('\\', '/', $projectDir_orig);
$this->media_path = $this->projectDir.'/public/media'; $media_path = $projectDir.'/public/media';
$this->footprint_path = $this->projectDir.'/public/img/footprints'; $footprint_path = $projectDir.'/public/img/footprints';
yield [$this->media_path.'/test/img.jpg', '%MEDIA%/test/img.jpg']; yield [$media_path.'/test/img.jpg', '%MEDIA%/test/img.jpg'];
yield [$this->media_path.'/test/img.jpg', '%BASE%/data/media/test/img.jpg', true]; yield [$media_path.'/test/img.jpg', '%BASE%/data/media/test/img.jpg', true];
yield [$this->footprint_path.'/foo.jpg', '%FOOTPRINTS%/foo.jpg']; yield [$footprint_path.'/foo.jpg', '%FOOTPRINTS%/foo.jpg'];
yield [$this->footprint_path.'/foo.jpg', '%FOOTPRINTS%/foo.jpg', true]; yield [$footprint_path.'/foo.jpg', '%FOOTPRINTS%/foo.jpg', true];
//Every kind of absolute path, that is not based with our placeholder dirs must be invald //Every kind of absolute path, that is not based with our placeholder dirs must be invald
yield ['/etc/passwd', null]; yield ['/etc/passwd', null];
yield ['C:\\not\\existing.txt', null]; yield ['C:\\not\\existing.txt', null];
//More than one placeholder is not allowed //More than one placeholder is not allowed
yield [$this->footprint_path.'/test/'.$this->footprint_path, null]; yield [$footprint_path.'/test/'.$footprint_path, null];
//Path must begin with path //Path must begin with path
yield ['/not/root'.$this->footprint_path, null]; yield ['/not/root'.$footprint_path, null];
} }
#[DataProvider('placeholderDataProvider')] #[DataProvider('placeholderDataProvider')]
@ -132,23 +132,23 @@ class AttachmentPathResolverTest extends WebTestCase
$this->assertSame($expected, $this->service->realPathToPlaceholder($param, $old_method)); $this->assertSame($expected, $this->service->realPathToPlaceholder($param, $old_method));
} }
public function germanFootprintPathdDataProvider(): ?\Generator public static function germanFootprintPathdDataProvider(): ?\Generator
{ {
self::bootKernel(); self::bootKernel();
$this->projectDir_orig = realpath(self::$kernel->getProjectDir()); $projectDir_orig = realpath(self::$kernel->getProjectDir());
$this->projectDir = str_replace('\\', '/', $this->projectDir_orig); $projectDir = str_replace('\\', '/', $projectDir_orig);
$this->footprint_path = $this->projectDir.'/public/img/footprints'; $footprint_path = $projectDir.'/public/img/footprints';
yield [$this->footprint_path. '/Active/Diodes/THT/DIODE_P600.png', '%FOOTPRINTS%/Aktiv/Dioden/Bedrahtet/DIODE_P600.png']; yield [$footprint_path. '/Active/Diodes/THT/DIODE_P600.png', '%FOOTPRINTS%/Aktiv/Dioden/Bedrahtet/DIODE_P600.png'];
yield [$this->footprint_path . '/Passive/Resistors/THT/Carbon/RESISTOR-CARBON_0207.png', '%FOOTPRINTS%/Passiv/Widerstaende/Bedrahtet/Kohleschicht/WIDERSTAND-KOHLE_0207.png']; yield [$footprint_path . '/Passive/Resistors/THT/Carbon/RESISTOR-CARBON_0207.png', '%FOOTPRINTS%/Passiv/Widerstaende/Bedrahtet/Kohleschicht/WIDERSTAND-KOHLE_0207.png'];
yield [$this->footprint_path . '/Optics/LEDs/THT/LED-GREEN_3MM.png', '%FOOTPRINTS%/Optik/LEDs/Bedrahtet/LED-GRUEN_3MM.png']; yield [$footprint_path . '/Optics/LEDs/THT/LED-GREEN_3MM.png', '%FOOTPRINTS%/Optik/LEDs/Bedrahtet/LED-GRUEN_3MM.png'];
yield [$this->footprint_path . '/Passive/Capacitors/TrimmerCapacitors/TRIMMER_CAPACITOR-RED_TZ03F.png', '%FOOTPRINTS%/Passiv/Kondensatoren/Trimmkondensatoren/TRIMMKONDENSATOR-ROT_TZ03F.png']; yield [$footprint_path . '/Passive/Capacitors/TrimmerCapacitors/TRIMMER_CAPACITOR-RED_TZ03F.png', '%FOOTPRINTS%/Passiv/Kondensatoren/Trimmkondensatoren/TRIMMKONDENSATOR-ROT_TZ03F.png'];
yield [$this->footprint_path . '/Active/ICs/TO/IC_TO126.png', '%FOOTPRINTS%/Aktiv/ICs/TO/IC_TO126.png']; yield [$footprint_path . '/Active/ICs/TO/IC_TO126.png', '%FOOTPRINTS%/Aktiv/ICs/TO/IC_TO126.png'];
yield [$this->footprint_path . '/Electromechanics/Switches_Buttons/RotarySwitches/ROTARY_SWITCH_DIP10.png', '%FOOTPRINTS%/Elektromechanik/Schalter_Taster/Drehschalter/DREHSCHALTER_DIP10.png']; yield [$footprint_path . '/Electromechanics/Switches_Buttons/RotarySwitches/ROTARY_SWITCH_DIP10.png', '%FOOTPRINTS%/Elektromechanik/Schalter_Taster/Drehschalter/DREHSCHALTER_DIP10.png'];
yield [$this->footprint_path . '/Electromechanics/Connectors/DINConnectors/SOCKET_DIN_MAB_4.png', '%FOOTPRINTS%/Elektromechanik/Verbinder/Rundsteckverbinder/BUCHSE_DIN_MAB_4.png']; yield [$footprint_path . '/Electromechanics/Connectors/DINConnectors/SOCKET_DIN_MAB_4.png', '%FOOTPRINTS%/Elektromechanik/Verbinder/Rundsteckverbinder/BUCHSE_DIN_MAB_4.png'];
//Leave english pathes untouched //Leave english pathes untouched
yield [$this->footprint_path . '/Passive/Capacitors/CAPACITOR_CTS_A_15MM.png', '%FOOTPRINTS%/Passive/Capacitors/CAPACITOR_CTS_A_15MM.png']; yield [$footprint_path . '/Passive/Capacitors/CAPACITOR_CTS_A_15MM.png', '%FOOTPRINTS%/Passive/Capacitors/CAPACITOR_CTS_A_15MM.png'];
} }
#[DataProvider('germanFootprintPathdDataProvider')] #[DataProvider('germanFootprintPathdDataProvider')]

View file

@ -39,7 +39,7 @@ class AttachmentURLGeneratorTest extends WebTestCase
self::$service = self::getContainer()->get(AttachmentURLGenerator::class); self::$service = self::getContainer()->get(AttachmentURLGenerator::class);
} }
public function dataProvider(): \Iterator public static function dataProvider(): \Iterator
{ {
yield ['/public/test.jpg', 'test.jpg']; yield ['/public/test.jpg', 'test.jpg'];
yield ['/public/folder/test.jpg', 'folder/test.jpg']; yield ['/public/folder/test.jpg', 'folder/test.jpg'];

View file

@ -44,7 +44,7 @@ class BuiltinAttachmentsFinderTest extends WebTestCase
self::$service = self::getContainer()->get(BuiltinAttachmentsFinder::class); self::$service = self::getContainer()->get(BuiltinAttachmentsFinder::class);
} }
public function dataProvider(): \Iterator public static function dataProvider(): \Iterator
{ {
//No value should return empty array //No value should return empty array
yield ['', [], []]; yield ['', [], []];

View file

@ -36,7 +36,7 @@ class FileTypeFilterToolsTest extends WebTestCase
self::$service = self::getContainer()->get(FileTypeFilterTools::class); self::$service = self::getContainer()->get(FileTypeFilterTools::class);
} }
public function validateDataProvider(): \Iterator public static function validateDataProvider(): \Iterator
{ {
yield ['', true]; yield ['', true];
//Empty string is valid //Empty string is valid
@ -55,7 +55,7 @@ class FileTypeFilterToolsTest extends WebTestCase
yield ['.png .jpg .gif', false]; yield ['.png .jpg .gif', false];
} }
public function normalizeDataProvider(): \Iterator public static function normalizeDataProvider(): \Iterator
{ {
yield ['', '']; yield ['', ''];
yield ['.jpeg,.png,.gif', '.jpeg,.png,.gif']; yield ['.jpeg,.png,.gif', '.jpeg,.png,.gif'];
@ -69,7 +69,7 @@ class FileTypeFilterToolsTest extends WebTestCase
yield ['png, .gif, .png,', '.png,.gif']; yield ['png, .gif, .png,', '.png,.gif'];
} }
public function extensionAllowedDataProvider(): \Iterator public static function extensionAllowedDataProvider(): \Iterator
{ {
yield ['', 'txt', true]; yield ['', 'txt', true];
yield ['', 'everything_should_match', true]; yield ['', 'everything_should_match', true];

View file

@ -174,7 +174,7 @@ EOT;
$this->assertSame($longName, $errors[0]['entity']->getName()); $this->assertSame($longName, $errors[0]['entity']->getName());
} }
public function formatDataProvider(): \Iterator public static function formatDataProvider(): \Iterator
{ {
yield ['csv', 'csv']; yield ['csv', 'csv'];
yield ['csv', 'CSV']; yield ['csv', 'CSV'];

View file

@ -29,7 +29,7 @@ use PHPUnit\Framework\TestCase;
class ParameterDTOTest extends TestCase class ParameterDTOTest extends TestCase
{ {
public function parseValueFieldDataProvider(): \Generator public static function parseValueFieldDataProvider(): \Generator
{ {
//Text value //Text value
yield [ yield [
@ -132,7 +132,7 @@ class ParameterDTOTest extends TestCase
]; ];
} }
public function parseValueIncludingUnitDataProvider(): \Generator public static function parseValueIncludingUnitDataProvider(): \Generator
{ {
//Text value //Text value
yield [ yield [

View file

@ -58,14 +58,14 @@ class BarcodeContentGeneratorTest extends KernelTestCase
$this->service = self::getContainer()->get(BarcodeContentGenerator::class); $this->service = self::getContainer()->get(BarcodeContentGenerator::class);
} }
public function Barcode1DDataProvider(): \Iterator public static function Barcode1DDataProvider(): \Iterator
{ {
yield ['P0000', Part::class]; yield ['P0000', Part::class];
yield ['L0000', PartLot::class]; yield ['L0000', PartLot::class];
yield ['S0000', StorageLocation::class]; yield ['S0000', StorageLocation::class];
} }
public function Barcode2DDataProvider(): \Iterator public static function Barcode2DDataProvider(): \Iterator
{ {
yield ['/scan/part/0', Part::class]; yield ['/scan/part/0', Part::class];
yield ['/scan/lot/0', PartLot::class]; yield ['/scan/lot/0', PartLot::class];

View file

@ -71,7 +71,7 @@ class LabelTextReplacerTest extends WebTestCase
$this->target->setComment('P Comment'); $this->target->setComment('P Comment');
} }
public function handlePlaceholderDataProvider(): \Iterator public static function handlePlaceholderDataProvider(): \Iterator
{ {
yield ['Part 1', '[[NAME]]']; yield ['Part 1', '[[NAME]]'];
yield ['P Description', '[[DESCRIPTION]]']; yield ['P Description', '[[DESCRIPTION]]'];
@ -83,7 +83,7 @@ class LabelTextReplacerTest extends WebTestCase
yield ['Test [[NAME]]', 'Test [[NAME]]', 'Test [[NAME]]']; yield ['Test [[NAME]]', 'Test [[NAME]]', 'Test [[NAME]]'];
} }
public function replaceDataProvider(): \Iterator public static function replaceDataProvider(): \Iterator
{ {
yield ['Part 1', '[[NAME]]']; yield ['Part 1', '[[NAME]]'];
yield ['TestPart 1', 'Test[[NAME]]']; yield ['TestPart 1', 'Test[[NAME]]'];

View file

@ -64,7 +64,7 @@ class AbstractElementProviderTest extends WebTestCase
}; };
} }
public function dataProvider(): \Iterator public static function dataProvider(): \Iterator
{ {
yield ['123', '[[ID]]']; yield ['123', '[[ID]]'];
} }

View file

@ -62,7 +62,7 @@ class GlobalProvidersTest extends WebTestCase
$this->target = new Part(); $this->target = new Part();
} }
public function dataProvider(): \Iterator public static function dataProvider(): \Iterator
{ {
yield ['Part-DB', '[[INSTALL_NAME]]']; yield ['Part-DB', '[[INSTALL_NAME]]'];
yield ['anonymous', '[[USERNAME]]']; yield ['anonymous', '[[USERNAME]]'];

View file

@ -67,7 +67,7 @@ class NamedElementProviderTest extends WebTestCase
}; };
} }
public function dataProvider(): \Iterator public static function dataProvider(): \Iterator
{ {
yield ['This is my Name', '[[NAME]]']; yield ['This is my Name', '[[NAME]]'];
} }

View file

@ -86,7 +86,7 @@ class PartLotProviderTest extends WebTestCase
$this->target->setOwner($user); $this->target->setOwner($user);
} }
public function dataProvider(): \Iterator public static function dataProvider(): \Iterator
{ {
yield ['unknown', '[[LOT_ID]]']; yield ['unknown', '[[LOT_ID]]'];
yield ['Lot description', '[[LOT_NAME]]']; yield ['Lot description', '[[LOT_NAME]]'];

View file

@ -87,7 +87,7 @@ class PartProviderTest extends WebTestCase
$this->target->setComment('<b>Bold</b> *Italic*'); $this->target->setComment('<b>Bold</b> *Italic*');
} }
public function dataProvider(): \Iterator public static function dataProvider(): \Iterator
{ {
yield ['Node 2.1', '[[CATEGORY]]']; yield ['Node 2.1', '[[CATEGORY]]'];
yield ['Node 2 → Node 2.1', '[[CATEGORY_FULL]]']; yield ['Node 2 → Node 2.1', '[[CATEGORY_FULL]]'];

View file

@ -75,7 +75,7 @@ class TimestampableElementProviderTest extends WebTestCase
}; };
} }
public function dataProvider(): \Iterator public static function dataProvider(): \Iterator
{ {
\Locale::setDefault('en'); \Locale::setDefault('en');
yield ['1/1/00, 12:00 AM', '[[LAST_MODIFIED]]']; yield ['1/1/00, 12:00 AM', '[[LAST_MODIFIED]]'];

View file

@ -62,7 +62,7 @@ class SandboxedTwigFactoryTest extends WebTestCase
$this->service = self::getContainer()->get(SandboxedTwigFactory::class); $this->service = self::getContainer()->get(SandboxedTwigFactory::class);
} }
public function twigDataProvider(): \Iterator public static function twigDataProvider(): \Iterator
{ {
yield [' {% for i in range(1, 3) %} yield [' {% for i in range(1, 3) %}
{{ part.id }} {{ part.id }}
@ -95,7 +95,7 @@ class SandboxedTwigFactoryTest extends WebTestCase
']; '];
} }
public function twigNotAllowedDataProvider(): \Iterator public static function twigNotAllowedDataProvider(): \Iterator
{ {
yield ['{% block test %} {% endblock %}']; yield ['{% block test %} {% endblock %}'];
yield ['{% deprecated test %}']; yield ['{% deprecated test %}'];

View file

@ -42,7 +42,7 @@ class FAIconGeneratorTest extends WebTestCase
$this->service = self::getContainer()->get(FAIconGenerator::class); $this->service = self::getContainer()->get(FAIconGenerator::class);
} }
public function fileExtensionDataProvider(): \Iterator public static function fileExtensionDataProvider(): \Iterator
{ {
yield ['pdf', 'fa-file-pdf']; yield ['pdf', 'fa-file-pdf'];
yield ['jpeg','fa-file-image']; yield ['jpeg','fa-file-image'];

View file

@ -58,7 +58,7 @@ class RangeParserTest extends WebTestCase
$this->service = self::getContainer()->get(RangeParser::class); $this->service = self::getContainer()->get(RangeParser::class);
} }
public function dataProvider(): \Iterator public static function dataProvider(): \Iterator
{ {
yield [[], '']; yield [[], ''];
yield [[], ' ']; yield [[], ' '];
@ -82,7 +82,7 @@ class RangeParserTest extends WebTestCase
yield [[], '1, 2, test', true]; yield [[], '1, 2, test', true];
} }
public function validDataProvider(): \Iterator public static function validDataProvider(): \Iterator
{ {
yield [true, '']; yield [true, ''];
yield [true, ' ']; yield [true, ' '];

View file

@ -57,7 +57,7 @@ class ParameterExtractorTest extends WebTestCase
$this->service = self::getContainer()->get(ParameterExtractor::class); $this->service = self::getContainer()->get(ParameterExtractor::class);
} }
public function emptyDataProvider(): \Iterator public static function emptyDataProvider(): \Iterator
{ {
yield ['']; yield [''];
yield [' ']; yield [' '];

View file

@ -44,7 +44,7 @@ class PricedetailHelperTest extends WebTestCase
$this->service = self::getContainer()->get(PricedetailHelper::class); $this->service = self::getContainer()->get(PricedetailHelper::class);
} }
public function maxDiscountAmountDataProvider(): ?\Generator public static function maxDiscountAmountDataProvider(): ?\Generator
{ {
$part = new Part(); $part = new Part();
yield [$part, null, 'Part without any orderdetails failed!']; yield [$part, null, 'Part without any orderdetails failed!'];

View file

@ -92,7 +92,7 @@ class PermissionManagerTest extends WebTestCase
$this->group->method('getParent')->willReturn($parent_group); $this->group->method('getParent')->willReturn($parent_group);
} }
public function getPermissionNames(): \Iterator public static function getPermissionNames(): \Iterator
{ {
//List some permission names //List some permission names
yield ['parts']; yield ['parts'];

View file

@ -47,7 +47,7 @@ class BackupCodeGeneratorTest extends TestCase
new BackupCodeGenerator(4, 10); new BackupCodeGenerator(4, 10);
} }
public function codeLengthDataProvider(): \Iterator public static function codeLengthDataProvider(): \Iterator
{ {
yield [6]; yield [6];
yield [8]; yield [8];
@ -62,7 +62,7 @@ class BackupCodeGeneratorTest extends TestCase
$this->assertMatchesRegularExpression("/^([a-f0-9]){{$code_length}}\$/", $generator->generateSingleCode()); $this->assertMatchesRegularExpression("/^([a-f0-9]){{$code_length}}\$/", $generator->generateSingleCode());
} }
public function codeCountDataProvider(): \Iterator public static function codeCountDataProvider(): \Iterator
{ {
yield [2]; yield [2];
yield [8]; yield [8];

View file

@ -37,7 +37,7 @@ class UserExtensionTest extends WebTestCase
$this->service = self::getContainer()->get(UserExtension::class); $this->service = self::getContainer()->get(UserExtension::class);
} }
public function removeLocaleFromPathDataSet(): ?\Generator public static function removeLocaleFromPathDataSet(): ?\Generator
{ {
yield ['/', '/de/']; yield ['/', '/de/'];
yield ['/test', '/de/test']; yield ['/test', '/de/test'];