Skip to content

Commit 7225a3f

Browse files
author
Florian Guimier
committed
Add DBAL BelgianEnterpriseNumberType type:
1 parent 0b32b4a commit 7225a3f

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace AssoConnect\DoctrineTypesBundle\Doctrine\DBAL\Types;
6+
7+
class BelgianEnterpriseNumberType extends AbstractFixedLengthStringType
8+
{
9+
public const NAME = 'belgianEnterpriseNumber';
10+
public const LENGTH = 10;
11+
12+
public function getName(): string
13+
{
14+
return self::NAME;
15+
}
16+
17+
protected function getLength(): int
18+
{
19+
return self::LENGTH;
20+
}
21+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace AssoConnect\DoctrineTypesBundle\Tests\Doctrine\DBAL\Types;
6+
7+
use AssoConnect\DoctrineTypesBundle\Doctrine\DBAL\Types\BelgianEnterpriseNumberType;
8+
use AssoConnect\DoctrineTypesBundle\Tests\TypeTestCase;
9+
10+
class BelgianEnterpriseNumberTypeTest extends TypeTestCase
11+
{
12+
protected function getClass(): string
13+
{
14+
return BelgianEnterpriseNumberType::class;
15+
}
16+
17+
public function testGetName(): void
18+
{
19+
self::assertSame(BelgianEnterpriseNumberType::NAME, $this->type->getName());
20+
}
21+
22+
public function testGetSQLDeclaration(): void
23+
{
24+
$this->abstractPlatform
25+
->method('getVarcharTypeDeclarationSQL')
26+
->with(['length' => BelgianEnterpriseNumberType::LENGTH])
27+
->willReturn("VARCHAR");
28+
29+
self::assertSame("VARCHAR", $this->type->getSQLDeclaration([], $this->abstractPlatform));
30+
}
31+
}

0 commit comments

Comments
 (0)