Fixed Github Workflow
This commit is contained in:
18
.github/workflows/pr.yml
vendored
18
.github/workflows/pr.yml
vendored
@@ -30,9 +30,9 @@ jobs:
|
|||||||
ini-values: memory_limit=-1
|
ini-values: memory_limit=-1
|
||||||
tools: composer:v2
|
tools: composer:v2
|
||||||
- name: Get Composer Cache Directory
|
- name: Get Composer Cache Directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: "Cache dependencies"
|
- name: "Cache dependencies"
|
||||||
uses: "actions/cache@v2"
|
uses: "actions/cache@v2"
|
||||||
with:
|
with:
|
||||||
@@ -64,9 +64,9 @@ jobs:
|
|||||||
ini-values: memory_limit=-1
|
ini-values: memory_limit=-1
|
||||||
tools: composer:v2
|
tools: composer:v2
|
||||||
- name: Get Composer Cache Directory
|
- name: Get Composer Cache Directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: "Cache dependencies"
|
- name: "Cache dependencies"
|
||||||
uses: "actions/cache@v2"
|
uses: "actions/cache@v2"
|
||||||
with:
|
with:
|
||||||
@@ -103,9 +103,9 @@ jobs:
|
|||||||
ini-values: memory_limit=-1
|
ini-values: memory_limit=-1
|
||||||
tools: composer:v2
|
tools: composer:v2
|
||||||
- name: Get Composer Cache Directory
|
- name: Get Composer Cache Directory
|
||||||
id: composer-cache
|
id: composer-cache
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||||
- name: "Cache dependencies"
|
- name: "Cache dependencies"
|
||||||
uses: "actions/cache@v2"
|
uses: "actions/cache@v2"
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"friendsofphp/php-cs-fixer": "^2.16",
|
"friendsofphp/php-cs-fixer": "^2.16",
|
||||||
"phpunit/phpunit": "^9.0",
|
"phpunit/phpunit": "^9.0",
|
||||||
"doctrine/dbal": "^2.5",
|
"doctrine/dbal": "^2.10.1|^3.0",
|
||||||
"symfony/var-dumper": "^5.1",
|
"symfony/var-dumper": "^5.1",
|
||||||
"vimeo/psalm": "^4.2"
|
"vimeo/psalm": "^4.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,15 +4,21 @@ namespace MNC\ChileanRut\Doctrine;
|
|||||||
|
|
||||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||||
use Doctrine\DBAL\Types\ConversionException;
|
use Doctrine\DBAL\Types\ConversionException;
|
||||||
|
use Doctrine\DBAL\Types\Type;
|
||||||
use MNC\ChileanRut\Rut;
|
use MNC\ChileanRut\Rut;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class NumericRutTypeTest extends TestCase
|
class NumericRutTypeTest extends TestCase
|
||||||
{
|
{
|
||||||
|
public static function setUpBeforeClass(): void
|
||||||
|
{
|
||||||
|
Type::addType(NumericRutType::NAME, NumericRutType::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function testItConvertsNullFromDatabaseValue(): void
|
public function testItConvertsNullFromDatabaseValue(): void
|
||||||
{
|
{
|
||||||
$platform = $this->createMock(AbstractPlatform::class);
|
$platform = $this->createMock(AbstractPlatform::class);
|
||||||
$type = new NumericRutType();
|
$type = Type::getType(NumericRutType::NAME);
|
||||||
$result = $type->convertToPHPValue(null, $platform);
|
$result = $type->convertToPHPValue(null, $platform);
|
||||||
self::assertNull($result);
|
self::assertNull($result);
|
||||||
}
|
}
|
||||||
@@ -20,7 +26,7 @@ class NumericRutTypeTest extends TestCase
|
|||||||
public function testItConvertsStringFromDatabaseValue(): void
|
public function testItConvertsStringFromDatabaseValue(): void
|
||||||
{
|
{
|
||||||
$platform = $this->createMock(AbstractPlatform::class);
|
$platform = $this->createMock(AbstractPlatform::class);
|
||||||
$type = new NumericRutType();
|
$type = Type::getType(NumericRutType::NAME);
|
||||||
$result = $type->convertToPHPValue(16894365, $platform);
|
$result = $type->convertToPHPValue(16894365, $platform);
|
||||||
self::assertInstanceOf(Rut::class, $result);
|
self::assertInstanceOf(Rut::class, $result);
|
||||||
}
|
}
|
||||||
@@ -28,7 +34,7 @@ class NumericRutTypeTest extends TestCase
|
|||||||
public function testItConvertsNullToDatabaseValue(): void
|
public function testItConvertsNullToDatabaseValue(): void
|
||||||
{
|
{
|
||||||
$platform = $this->createMock(AbstractPlatform::class);
|
$platform = $this->createMock(AbstractPlatform::class);
|
||||||
$type = new NumericRutType();
|
$type = Type::getType(NumericRutType::NAME);
|
||||||
$result = $type->convertToDatabaseValue(null, $platform);
|
$result = $type->convertToDatabaseValue(null, $platform);
|
||||||
self::assertNull($result);
|
self::assertNull($result);
|
||||||
}
|
}
|
||||||
@@ -36,7 +42,7 @@ class NumericRutTypeTest extends TestCase
|
|||||||
public function testItConvertsRutToDatabaseValue(): void
|
public function testItConvertsRutToDatabaseValue(): void
|
||||||
{
|
{
|
||||||
$platform = $this->createMock(AbstractPlatform::class);
|
$platform = $this->createMock(AbstractPlatform::class);
|
||||||
$type = new NumericRutType();
|
$type = Type::getType(NumericRutType::NAME);
|
||||||
$result = $type->convertToDatabaseValue(Rut::parse('168943652'), $platform);
|
$result = $type->convertToDatabaseValue(Rut::parse('168943652'), $platform);
|
||||||
self::assertSame('16894365', $result);
|
self::assertSame('16894365', $result);
|
||||||
}
|
}
|
||||||
@@ -44,7 +50,7 @@ class NumericRutTypeTest extends TestCase
|
|||||||
public function testItCannotConvertToDatabaseValue(): void
|
public function testItCannotConvertToDatabaseValue(): void
|
||||||
{
|
{
|
||||||
$platform = $this->createMock(AbstractPlatform::class);
|
$platform = $this->createMock(AbstractPlatform::class);
|
||||||
$type = new NumericRutType();
|
$type = Type::getType(NumericRutType::NAME);
|
||||||
$this->expectException(ConversionException::class);
|
$this->expectException(ConversionException::class);
|
||||||
$type->convertToDatabaseValue(new \DateTime(), $platform);
|
$type->convertToDatabaseValue(new \DateTime(), $platform);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,21 @@ namespace MNC\ChileanRut\Doctrine;
|
|||||||
|
|
||||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||||
use Doctrine\DBAL\Types\ConversionException;
|
use Doctrine\DBAL\Types\ConversionException;
|
||||||
|
use Doctrine\DBAL\Types\Type;
|
||||||
use MNC\ChileanRut\Rut;
|
use MNC\ChileanRut\Rut;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class RutTypeTest extends TestCase
|
class RutTypeTest extends TestCase
|
||||||
{
|
{
|
||||||
|
public static function setUpBeforeClass(): void
|
||||||
|
{
|
||||||
|
Type::addType(RutType::NAME, RutType::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function testItConvertsNullFromDatabaseValue(): void
|
public function testItConvertsNullFromDatabaseValue(): void
|
||||||
{
|
{
|
||||||
$platform = $this->createMock(AbstractPlatform::class);
|
$platform = $this->createMock(AbstractPlatform::class);
|
||||||
$type = new RutType();
|
$type = Type::getType(RutType::NAME);
|
||||||
$result = $type->convertToPHPValue(null, $platform);
|
$result = $type->convertToPHPValue(null, $platform);
|
||||||
self::assertNull($result);
|
self::assertNull($result);
|
||||||
}
|
}
|
||||||
@@ -20,7 +26,7 @@ class RutTypeTest extends TestCase
|
|||||||
public function testItConvertsStringFromDatabaseValue(): void
|
public function testItConvertsStringFromDatabaseValue(): void
|
||||||
{
|
{
|
||||||
$platform = $this->createMock(AbstractPlatform::class);
|
$platform = $this->createMock(AbstractPlatform::class);
|
||||||
$type = new RutType();
|
$type = Type::getType(RutType::NAME);
|
||||||
$result = $type->convertToPHPValue('16.894.365-2', $platform);
|
$result = $type->convertToPHPValue('16.894.365-2', $platform);
|
||||||
self::assertInstanceOf(Rut::class, $result);
|
self::assertInstanceOf(Rut::class, $result);
|
||||||
}
|
}
|
||||||
@@ -28,7 +34,7 @@ class RutTypeTest extends TestCase
|
|||||||
public function testItCannotConvertFromDatabaseValue(): void
|
public function testItCannotConvertFromDatabaseValue(): void
|
||||||
{
|
{
|
||||||
$platform = $this->createMock(AbstractPlatform::class);
|
$platform = $this->createMock(AbstractPlatform::class);
|
||||||
$type = new RutType();
|
$type = Type::getType(RutType::NAME);
|
||||||
$this->expectException(ConversionException::class);
|
$this->expectException(ConversionException::class);
|
||||||
$type->convertToPHPValue(true, $platform);
|
$type->convertToPHPValue(true, $platform);
|
||||||
}
|
}
|
||||||
@@ -36,7 +42,7 @@ class RutTypeTest extends TestCase
|
|||||||
public function testItConvertsNullToDatabaseValue(): void
|
public function testItConvertsNullToDatabaseValue(): void
|
||||||
{
|
{
|
||||||
$platform = $this->createMock(AbstractPlatform::class);
|
$platform = $this->createMock(AbstractPlatform::class);
|
||||||
$type = new RutType();
|
$type = Type::getType(RutType::NAME);
|
||||||
$result = $type->convertToDatabaseValue(null, $platform);
|
$result = $type->convertToDatabaseValue(null, $platform);
|
||||||
self::assertNull($result);
|
self::assertNull($result);
|
||||||
}
|
}
|
||||||
@@ -44,7 +50,7 @@ class RutTypeTest extends TestCase
|
|||||||
public function testItConvertsRutToDatabaseValue(): void
|
public function testItConvertsRutToDatabaseValue(): void
|
||||||
{
|
{
|
||||||
$platform = $this->createMock(AbstractPlatform::class);
|
$platform = $this->createMock(AbstractPlatform::class);
|
||||||
$type = new RutType();
|
$type = Type::getType(RutType::NAME);
|
||||||
$result = $type->convertToDatabaseValue(Rut::parse('168943652'), $platform);
|
$result = $type->convertToDatabaseValue(Rut::parse('168943652'), $platform);
|
||||||
self::assertSame('16.894.365-2', $result);
|
self::assertSame('16.894.365-2', $result);
|
||||||
}
|
}
|
||||||
@@ -52,7 +58,7 @@ class RutTypeTest extends TestCase
|
|||||||
public function testItCannotConvertToDatabaseValue(): void
|
public function testItCannotConvertToDatabaseValue(): void
|
||||||
{
|
{
|
||||||
$platform = $this->createMock(AbstractPlatform::class);
|
$platform = $this->createMock(AbstractPlatform::class);
|
||||||
$type = new RutType();
|
$type = Type::getType(RutType::NAME);
|
||||||
$this->expectException(ConversionException::class);
|
$this->expectException(ConversionException::class);
|
||||||
$type->convertToDatabaseValue(new \DateTime(), $platform);
|
$type->convertToDatabaseValue(new \DateTime(), $platform);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user