Ran rector and made tests final

This commit is contained in:
Jan Böhmer 2026-02-14 23:32:43 +01:00
parent 43d72faf48
commit b21d294cf8
162 changed files with 407 additions and 393 deletions

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,50 +20,50 @@
* 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\Validator\Constraints;
use App\Validator\Constraints\ValidGTIN;
use App\Validator\Constraints\ValidGTINValidator;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Validator\ConstraintValidatorInterface;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
class ValidGTINValidatorTest extends ConstraintValidatorTestCase
final class ValidGTINValidatorTest extends ConstraintValidatorTestCase
{
public function testAllowNull(): void
{
$this->validator->validate(null, new \App\Validator\Constraints\ValidGTIN());
$this->validator->validate(null, new ValidGTIN());
$this->assertNoViolation();
}
public function testValidGTIN8(): void
{
$this->validator->validate('12345670', new \App\Validator\Constraints\ValidGTIN());
$this->validator->validate('12345670', new ValidGTIN());
$this->assertNoViolation();
}
public function testValidGTIN12(): void
{
$this->validator->validate('123456789012', new \App\Validator\Constraints\ValidGTIN());
$this->validator->validate('123456789012', new ValidGTIN());
$this->assertNoViolation();
}
public function testValidGTIN13(): void
{
$this->validator->validate('1234567890128', new \App\Validator\Constraints\ValidGTIN());
$this->validator->validate('1234567890128', new ValidGTIN());
$this->assertNoViolation();
}
public function testValidGTIN14(): void
{
$this->validator->validate('12345678901231', new \App\Validator\Constraints\ValidGTIN());
$this->validator->validate('12345678901231', new ValidGTIN());
$this->assertNoViolation();
}
public function testInvalidGTIN(): void
{
$this->validator->validate('1234567890123', new \App\Validator\Constraints\ValidGTIN());
$this->validator->validate('1234567890123', new ValidGTIN());
$this->buildViolation('validator.invalid_gtin')
->assertRaised();
}