mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-16 14:39:37 +00:00
Ran rector and made tests final
This commit is contained in:
parent
43d72faf48
commit
b21d294cf8
162 changed files with 407 additions and 393 deletions
|
|
@ -28,15 +28,12 @@ use App\Validator\Constraints\NoneOfItsChildren;
|
|||
use App\Validator\Constraints\NoneOfItsChildrenValidator;
|
||||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
||||
|
||||
class NoneOfItsChildrenValidatorTest extends ConstraintValidatorTestCase
|
||||
final class NoneOfItsChildrenValidatorTest extends ConstraintValidatorTestCase
|
||||
{
|
||||
|
||||
protected AttachmentType $root_node;
|
||||
protected AttachmentType $child1;
|
||||
protected AttachmentType $child2;
|
||||
protected AttachmentType $child3;
|
||||
protected AttachmentType $child1_1;
|
||||
protected AttachmentType $child1_2;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
|
|
@ -49,14 +46,14 @@ class NoneOfItsChildrenValidatorTest extends ConstraintValidatorTestCase
|
|||
$this->root_node->setName('root')->setParent(null);
|
||||
$this->child1 = new AttachmentType();
|
||||
$this->child1->setParent($this->root_node)->setName('child1');
|
||||
$this->child2 = new AttachmentType();
|
||||
$this->child2->setName('child2')->setParent($this->root_node);
|
||||
$this->child3 = new AttachmentType();
|
||||
$this->child3->setName('child3')->setParent($this->root_node);
|
||||
$child2 = new AttachmentType();
|
||||
$child2->setName('child2')->setParent($this->root_node);
|
||||
$child3 = new AttachmentType();
|
||||
$child3->setName('child3')->setParent($this->root_node);
|
||||
$this->child1_1 = new AttachmentType();
|
||||
$this->child1_1->setName('child1_1')->setParent($this->child1);
|
||||
$this->child1_2 = new AttachmentType();
|
||||
$this->child1_2->setName('child1_2')->setParent($this->child1);
|
||||
$child1_2 = new AttachmentType();
|
||||
$child1_2->setName('child1_2')->setParent($this->child1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ use PHPUnit\Framework\TestCase;
|
|||
use Symfony\Component\Validator\Exception\UnexpectedValueException;
|
||||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
||||
|
||||
class SelectableValidatorTest extends ConstraintValidatorTestCase
|
||||
final class SelectableValidatorTest extends ConstraintValidatorTestCase
|
||||
{
|
||||
protected function createValidator(): SelectableValidator
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ use PHPUnit\Framework\TestCase;
|
|||
use Symfony\Component\Validator\Exception\UnexpectedValueException;
|
||||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
||||
|
||||
class UniqueObjectCollectionValidatorTest extends ConstraintValidatorTestCase
|
||||
final class UniqueObjectCollectionValidatorTest extends ConstraintValidatorTestCase
|
||||
{
|
||||
protected function createValidator(): UniqueObjectCollectionValidator
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use App\Validator\Constraints\UrlOrBuiltinValidator;
|
|||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
||||
|
||||
class UrlOrBuiltinValidatorTest extends ConstraintValidatorTestCase
|
||||
final class UrlOrBuiltinValidatorTest extends ConstraintValidatorTestCase
|
||||
{
|
||||
|
||||
protected function createValidator(): UrlOrBuiltinValidator
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ use Symfony\Component\Validator\ConstraintValidator;
|
|||
use Symfony\Component\Validator\ConstraintValidatorInterface;
|
||||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
||||
|
||||
class ValidGoogleAuthCodeValidatorTest extends ConstraintValidatorTestCase
|
||||
final class ValidGoogleAuthCodeValidatorTest extends ConstraintValidatorTestCase
|
||||
{
|
||||
|
||||
protected function createValidator(): ConstraintValidatorInterface
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use App\Validator\Constraints\ValidThemeValidator;
|
|||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
||||
|
||||
class ValidThemeValidatorTest extends ConstraintValidatorTestCase
|
||||
final class ValidThemeValidatorTest extends ConstraintValidatorTestCase
|
||||
{
|
||||
|
||||
protected function createValidator(): ValidThemeValidator
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue