Applied rectors phpunit 9 migrations to tests

This commit is contained in:
Jan Böhmer 2023-06-11 15:15:55 +02:00
parent 684334ba22
commit fcbb1849ec
22 changed files with 162 additions and 187 deletions

View file

@ -57,33 +57,31 @@ class BarcodeNormalizerTest extends WebTestCase
$this->service = self::getContainer()->get(BarcodeNormalizer::class);
}
public function dataProvider(): array
public function dataProvider(): \Iterator
{
return [
//QR URL content:
[['lot', 1], 'https://localhost:8000/scan/lot/1'],
[['part', 123], 'https://localhost:8000/scan/part/123'],
[['location', 4], 'http://foo.bar/part-db/scan/location/4'],
[['under_score', 10], 'http://test/part-db/sub/scan/under_score/10/'],
//Current Code39 format:
[['lot', 10], 'L0010'],
[['lot', 123], 'L0123'],
[['lot', 123456], 'L123456'],
[['part', 2], 'P0002'],
//Development phase Code39 barcodes:
[['lot', 10], 'L-000010'],
[['lot', 10], 'Lß000010'],
[['part', 123], 'P-000123'],
[['location', 123], 'S-000123'],
[['lot', 12_345_678], 'L-12345678'],
//Legacy storelocation format
[['location', 336], '$L00336'],
[['location', 12_345_678], '$L12345678'],
//Legacy Part format
[['part', 123], '0000123'],
[['part', 123], '00001236'],
[['part', 1_234_567], '12345678'],
];
//QR URL content:
yield [['lot', 1], 'https://localhost:8000/scan/lot/1'];
yield [['part', 123], 'https://localhost:8000/scan/part/123'];
yield [['location', 4], 'http://foo.bar/part-db/scan/location/4'];
yield [['under_score', 10], 'http://test/part-db/sub/scan/under_score/10/'];
//Current Code39 format:
yield [['lot', 10], 'L0010'];
yield [['lot', 123], 'L0123'];
yield [['lot', 123456], 'L123456'];
yield [['part', 2], 'P0002'];
//Development phase Code39 barcodes:
yield [['lot', 10], 'L-000010'];
yield [['lot', 10], 'Lß000010'];
yield [['part', 123], 'P-000123'];
yield [['location', 123], 'S-000123'];
yield [['lot', 12_345_678], 'L-12345678'];
//Legacy storelocation format
yield [['location', 336], '$L00336'];
yield [['location', 12_345_678], '$L12345678'];
//Legacy Part format
yield [['part', 123], '0000123'];
yield [['part', 123], '00001236'];
yield [['part', 1_234_567], '12345678'];
}
public function invalidDataProvider(): array

View file

@ -63,11 +63,9 @@ class AbstractElementProviderTest extends WebTestCase
};
}
public function dataProvider(): array
public function dataProvider(): \Iterator
{
return [
['123', '[[ID]]'],
];
yield ['123', '[[ID]]'];
}
/**

View file

@ -61,12 +61,10 @@ class GlobalProvidersTest extends WebTestCase
$this->target = new Part();
}
public function dataProvider(): array
public function dataProvider(): \Iterator
{
return [
['Part-DB', '[[INSTALL_NAME]]'],
['anonymous', '[[USERNAME]]'],
];
yield ['Part-DB', '[[INSTALL_NAME]]'];
yield ['anonymous', '[[USERNAME]]'];
}
/**

View file

@ -66,11 +66,9 @@ class NamedElementProviderTest extends WebTestCase
};
}
public function dataProvider(): array
public function dataProvider(): \Iterator
{
return [
['This is my Name', '[[NAME]]'],
];
yield ['This is my Name', '[[NAME]]'];
}
/**

View file

@ -85,22 +85,20 @@ class PartLotProviderTest extends WebTestCase
$this->target->setOwner($user);
}
public function dataProvider(): array
public function dataProvider(): \Iterator
{
return [
['unknown', '[[LOT_ID]]'],
['Lot description', '[[LOT_NAME]]'],
['Lot comment', '[[LOT_COMMENT]]'],
['4/13/99', '[[EXPIRATION_DATE]]'],
['?', '[[AMOUNT]]'],
['Location', '[[LOCATION]]'],
['Parent → Location', '[[LOCATION_FULL]]'],
//Test part inheritance
['Part', '[[NAME]]'],
['Part description', '[[DESCRIPTION]]'],
['John Doe', '[[OWNER]]'],
['user', '[[OWNER_USERNAME]]'],
];
yield ['unknown', '[[LOT_ID]]'];
yield ['Lot description', '[[LOT_NAME]]'];
yield ['Lot comment', '[[LOT_COMMENT]]'];
yield ['4/13/99', '[[EXPIRATION_DATE]]'];
yield ['?', '[[AMOUNT]]'];
yield ['Location', '[[LOCATION]]'];
yield ['Parent → Location', '[[LOCATION_FULL]]'];
//Test part inheritance
yield ['Part', '[[NAME]]'];
yield ['Part description', '[[DESCRIPTION]]'];
yield ['John Doe', '[[OWNER]]'];
yield ['user', '[[OWNER_USERNAME]]'];
}
/**

View file

@ -86,25 +86,22 @@ class PartProviderTest extends WebTestCase
$this->target->setComment('<b>Bold</b> *Italic*');
}
public function dataProvider(): array
public function dataProvider(): \Iterator
{
return [
['Node 2.1', '[[CATEGORY]]'],
['Node 2 → Node 2.1', '[[CATEGORY_FULL]]'],
['Node 2.1', '[[FOOTPRINT]]'],
['Node 2 → Node 2.1', '[[FOOTPRINT_FULL]]'],
['', '[[MANUFACTURER]]'],
['', '[[MANUFACTURER_FULL]]'],
['1.2 kg', '[[MASS]]'],
['MPN123', '[[MPN]]'],
['SMD, Tag1, Tag2', '[[TAGS]]'],
['Active', '[[M_STATUS]]'],
['<b>Bold</b> <em>Italic</em>', '[[DESCRIPTION]]'],
['Bold Italic', '[[DESCRIPTION_T]]'],
['<b>Bold</b> <em>Italic</em>', '[[COMMENT]]'],
['Bold Italic', '[[COMMENT_T]]'],
];
yield ['Node 2.1', '[[CATEGORY]]'];
yield ['Node 2 → Node 2.1', '[[CATEGORY_FULL]]'];
yield ['Node 2.1', '[[FOOTPRINT]]'];
yield ['Node 2 → Node 2.1', '[[FOOTPRINT_FULL]]'];
yield ['', '[[MANUFACTURER]]'];
yield ['', '[[MANUFACTURER_FULL]]'];
yield ['1.2 kg', '[[MASS]]'];
yield ['MPN123', '[[MPN]]'];
yield ['SMD, Tag1, Tag2', '[[TAGS]]'];
yield ['Active', '[[M_STATUS]]'];
yield ['<b>Bold</b> <em>Italic</em>', '[[DESCRIPTION]]'];
yield ['Bold Italic', '[[DESCRIPTION_T]]'];
yield ['<b>Bold</b> <em>Italic</em>', '[[COMMENT]]'];
yield ['Bold Italic', '[[COMMENT_T]]'];
}
/**

View file

@ -74,14 +74,11 @@ class TimestampableElementProviderTest extends WebTestCase
};
}
public function dataProvider(): array
public function dataProvider(): \Iterator
{
\Locale::setDefault('en');
return [
['1/1/00, 12:00 AM', '[[LAST_MODIFIED]]'],
['1/1/00, 12:00 AM', '[[CREATION_DATE]]'],
];
yield ['1/1/00, 12:00 AM', '[[LAST_MODIFIED]]'];
yield ['1/1/00, 12:00 AM', '[[CREATION_DATE]]'];
}
/**