Applied rector suggestions

This commit is contained in:
Jan Böhmer 2024-06-22 00:31:43 +02:00
parent 4106bcef5f
commit 20f32c7f12
170 changed files with 808 additions and 761 deletions

View file

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

View file

@ -1,4 +1,7 @@
<?php
declare(strict_types=1);
/*
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
@ -17,7 +20,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Tests\Services\LabelSystem\Barcodes;
use App\Entity\LabelSystem\BarcodeType;

View file

@ -58,14 +58,12 @@ final class BarcodeRedirectorTest extends KernelTestCase
$this->service = self::getContainer()->get(BarcodeRedirector::class);
}
public static function urlDataProvider(): array
public static function urlDataProvider(): \Iterator
{
return [
[new BarcodeScanResult(LabelSupportedElement::PART, 1, BarcodeSourceType::INTERNAL), '/en/part/1'],
//Part lot redirects to Part info page (Part lot 1 is associated with part 3)
[new BarcodeScanResult(LabelSupportedElement::PART_LOT, 1, BarcodeSourceType::INTERNAL), '/en/part/3'],
[new BarcodeScanResult(LabelSupportedElement::STORELOCATION, 1, BarcodeSourceType::INTERNAL), '/en/store_location/1/parts'],
];
yield [new BarcodeScanResult(LabelSupportedElement::PART, 1, BarcodeSourceType::INTERNAL), '/en/part/1'];
//Part lot redirects to Part info page (Part lot 1 is associated with part 3)
yield [new BarcodeScanResult(LabelSupportedElement::PART_LOT, 1, BarcodeSourceType::INTERNAL), '/en/part/3'];
yield [new BarcodeScanResult(LabelSupportedElement::STORELOCATION, 1, BarcodeSourceType::INTERNAL), '/en/store_location/1/parts'];
}
/**

View file

@ -113,16 +113,19 @@ class BarcodeScanHelperTest extends WebTestCase
'lot2_vendor_barcode'];
}
public static function invalidDataProvider(): array
public static function invalidDataProvider(): \Iterator
{
return [
['https://localhost/part/1'], //Without scan
['L-'], //Without number
['L-123'], //Too short
['X-123456'], //Unknown prefix
['XXXWADSDF sdf'], //Garbage
[''], //Empty
];
yield ['https://localhost/part/1'];
//Without scan
yield ['L-'];
//Without number
yield ['L-123'];
//Too short
yield ['X-123456'];
//Unknown prefix
yield ['XXXWADSDF sdf'];
//Garbage
yield [''];
}
/**