Fixed Github Workflow
This commit is contained in:
@@ -4,15 +4,21 @@ namespace MNC\ChileanRut\Doctrine;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Types\ConversionException;
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
use MNC\ChileanRut\Rut;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class NumericRutTypeTest extends TestCase
|
||||
{
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
Type::addType(NumericRutType::NAME, NumericRutType::class);
|
||||
}
|
||||
|
||||
public function testItConvertsNullFromDatabaseValue(): void
|
||||
{
|
||||
$platform = $this->createMock(AbstractPlatform::class);
|
||||
$type = new NumericRutType();
|
||||
$type = Type::getType(NumericRutType::NAME);
|
||||
$result = $type->convertToPHPValue(null, $platform);
|
||||
self::assertNull($result);
|
||||
}
|
||||
@@ -20,7 +26,7 @@ class NumericRutTypeTest extends TestCase
|
||||
public function testItConvertsStringFromDatabaseValue(): void
|
||||
{
|
||||
$platform = $this->createMock(AbstractPlatform::class);
|
||||
$type = new NumericRutType();
|
||||
$type = Type::getType(NumericRutType::NAME);
|
||||
$result = $type->convertToPHPValue(16894365, $platform);
|
||||
self::assertInstanceOf(Rut::class, $result);
|
||||
}
|
||||
@@ -28,7 +34,7 @@ class NumericRutTypeTest extends TestCase
|
||||
public function testItConvertsNullToDatabaseValue(): void
|
||||
{
|
||||
$platform = $this->createMock(AbstractPlatform::class);
|
||||
$type = new NumericRutType();
|
||||
$type = Type::getType(NumericRutType::NAME);
|
||||
$result = $type->convertToDatabaseValue(null, $platform);
|
||||
self::assertNull($result);
|
||||
}
|
||||
@@ -36,7 +42,7 @@ class NumericRutTypeTest extends TestCase
|
||||
public function testItConvertsRutToDatabaseValue(): void
|
||||
{
|
||||
$platform = $this->createMock(AbstractPlatform::class);
|
||||
$type = new NumericRutType();
|
||||
$type = Type::getType(NumericRutType::NAME);
|
||||
$result = $type->convertToDatabaseValue(Rut::parse('168943652'), $platform);
|
||||
self::assertSame('16894365', $result);
|
||||
}
|
||||
@@ -44,7 +50,7 @@ class NumericRutTypeTest extends TestCase
|
||||
public function testItCannotConvertToDatabaseValue(): void
|
||||
{
|
||||
$platform = $this->createMock(AbstractPlatform::class);
|
||||
$type = new NumericRutType();
|
||||
$type = Type::getType(NumericRutType::NAME);
|
||||
$this->expectException(ConversionException::class);
|
||||
$type->convertToDatabaseValue(new \DateTime(), $platform);
|
||||
}
|
||||
|
||||
@@ -4,15 +4,21 @@ namespace MNC\ChileanRut\Doctrine;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Types\ConversionException;
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
use MNC\ChileanRut\Rut;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class RutTypeTest extends TestCase
|
||||
{
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
Type::addType(RutType::NAME, RutType::class);
|
||||
}
|
||||
|
||||
public function testItConvertsNullFromDatabaseValue(): void
|
||||
{
|
||||
$platform = $this->createMock(AbstractPlatform::class);
|
||||
$type = new RutType();
|
||||
$type = Type::getType(RutType::NAME);
|
||||
$result = $type->convertToPHPValue(null, $platform);
|
||||
self::assertNull($result);
|
||||
}
|
||||
@@ -20,7 +26,7 @@ class RutTypeTest extends TestCase
|
||||
public function testItConvertsStringFromDatabaseValue(): void
|
||||
{
|
||||
$platform = $this->createMock(AbstractPlatform::class);
|
||||
$type = new RutType();
|
||||
$type = Type::getType(RutType::NAME);
|
||||
$result = $type->convertToPHPValue('16.894.365-2', $platform);
|
||||
self::assertInstanceOf(Rut::class, $result);
|
||||
}
|
||||
@@ -28,7 +34,7 @@ class RutTypeTest extends TestCase
|
||||
public function testItCannotConvertFromDatabaseValue(): void
|
||||
{
|
||||
$platform = $this->createMock(AbstractPlatform::class);
|
||||
$type = new RutType();
|
||||
$type = Type::getType(RutType::NAME);
|
||||
$this->expectException(ConversionException::class);
|
||||
$type->convertToPHPValue(true, $platform);
|
||||
}
|
||||
@@ -36,7 +42,7 @@ class RutTypeTest extends TestCase
|
||||
public function testItConvertsNullToDatabaseValue(): void
|
||||
{
|
||||
$platform = $this->createMock(AbstractPlatform::class);
|
||||
$type = new RutType();
|
||||
$type = Type::getType(RutType::NAME);
|
||||
$result = $type->convertToDatabaseValue(null, $platform);
|
||||
self::assertNull($result);
|
||||
}
|
||||
@@ -44,7 +50,7 @@ class RutTypeTest extends TestCase
|
||||
public function testItConvertsRutToDatabaseValue(): void
|
||||
{
|
||||
$platform = $this->createMock(AbstractPlatform::class);
|
||||
$type = new RutType();
|
||||
$type = Type::getType(RutType::NAME);
|
||||
$result = $type->convertToDatabaseValue(Rut::parse('168943652'), $platform);
|
||||
self::assertSame('16.894.365-2', $result);
|
||||
}
|
||||
@@ -52,7 +58,7 @@ class RutTypeTest extends TestCase
|
||||
public function testItCannotConvertToDatabaseValue(): void
|
||||
{
|
||||
$platform = $this->createMock(AbstractPlatform::class);
|
||||
$type = new RutType();
|
||||
$type = Type::getType(RutType::NAME);
|
||||
$this->expectException(ConversionException::class);
|
||||
$type->convertToDatabaseValue(new \DateTime(), $platform);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user