Skip to content

Commit

Permalink
codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
michnovka committed Dec 16, 2022
1 parent b2270e6 commit 1352254
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 50 deletions.
27 changes: 1 addition & 26 deletions tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Doctrine\ORM\Mapping\DefaultTypedFieldMapper;
use Doctrine\ORM\Mapping\MappedSuperclass;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\ORM\Mapping\TypedFieldMapper;
use Doctrine\ORM\Mapping\UnderscoreNamingStrategy;
use Doctrine\Persistence\Mapping\RuntimeReflectionService;
use Doctrine\Persistence\Mapping\StaticReflectionService;
Expand All @@ -32,11 +31,10 @@
use Doctrine\Tests\Models\DDC964\DDC964Guest;
use Doctrine\Tests\Models\Routing\RoutingLeg;
use Doctrine\Tests\Models\TypedProperties;
use Doctrine\Tests\ORM\Mapping\TypedFieldMapper\CustomIntAsStringTypedFieldMapper;
use Doctrine\Tests\OrmTestCase;
use DoctrineGlobalArticle;
use ReflectionClass;
use ReflectionNamedType;
use ReflectionProperty;

use function assert;
use function count;
Expand Down Expand Up @@ -1382,26 +1380,3 @@ public function propertyToColumnName($propertyName, $className = null)
class MyArrayObjectEntity extends ArrayObject
{
}


final class CustomIntAsStringTypedFieldMapper implements TypedFieldMapper
{
/**
* {@inheritdoc}
*/
public function validateAndComplete(array $mapping, ReflectionProperty $field): array
{
$type = $field->getType();

if (
! isset($mapping['type'])
&& ($type instanceof ReflectionNamedType)
) {
if ($type->getName() === 'int') {
$mapping['type'] = Types::STRING;
}
}

return $mapping;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Doctrine\Tests\ORM\Mapping\TypedFieldMapper;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\TypedFieldMapper;
use ReflectionNamedType;
use ReflectionProperty;

final class CustomIntAsStringTypedFieldMapper implements TypedFieldMapper
{
/**
* {@inheritdoc}
*/
public function validateAndComplete(array $mapping, ReflectionProperty $field): array
{
$type = $field->getType();

if (
! isset($mapping['type'])
&& ($type instanceof ReflectionNamedType)
) {
if ($type->getName() === 'int') {
$mapping['type'] = Types::STRING;
}
}

return $mapping;
}
}
25 changes: 1 addition & 24 deletions tests/Doctrine/Tests/ORM/Mapping/TypedFieldMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
use Doctrine\ORM\Mapping\DefaultTypedFieldMapper;
use Doctrine\ORM\Mapping\TypedFieldMapper;
use Doctrine\Tests\Models\TypedProperties\UserTyped;
use Doctrine\Tests\ORM\Mapping\TypedFieldMapper\CustomIntAsStringTypedFieldMapper;
use Doctrine\Tests\OrmTestCase;
use ReflectionClass;
use ReflectionNamedType;
use ReflectionProperty;

/**
* @group GH10313
Expand Down Expand Up @@ -85,25 +84,3 @@ public function testValidateAndComplete(
self::assertSame($finalMapping, $typedFieldMapper->validateAndComplete($mapping, $reflectionClass->getProperty($mapping['fieldName'])));
}
}

final class CustomIntAsStringTypedFieldMapper implements TypedFieldMapper
{
/**
* {@inheritdoc}
*/
public function validateAndComplete(array $mapping, ReflectionProperty $field): array
{
$type = $field->getType();

if (
! isset($mapping['type'])
&& ($type instanceof ReflectionNamedType)
) {
if ($type->getName() === 'int') {
$mapping['type'] = Types::STRING;
}
}

return $mapping;
}
}

0 comments on commit 1352254

Please sign in to comment.