Implemented test for AbstractType to keep code coverage high

This commit is contained in:
Kevin Frantz 2018-11-04 14:24:58 +01:00
parent e28f17b88e
commit 6bf17f5935
5 changed files with 51 additions and 4 deletions

View File

@ -0,0 +1,9 @@
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType as AbstractSymfonyType;
class AbstractType extends AbstractSymfonyType
{
}

View File

@ -2,11 +2,10 @@
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use App\Entity\Source\NameSource;
use App\Entity\Source\Data\NameSource;
class NameSourceType extends AbstractType
{

View File

@ -3,7 +3,6 @@
namespace App\Form;
use App\Entity\User;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

View File

@ -3,7 +3,6 @@
namespace App\Form;
use App\Entity\User;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;

View File

@ -0,0 +1,41 @@
<?php
namespace Tests\Unit\Form;
use PHPUnit\Framework\TestCase;
use App\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* This class just exists to keep the code coverage high.
*
* @todo Implement better tests!
*
* @author kevinfrantz
*/
class AbstractTypeTest extends TestCase
{
/**
* @var AbstractType
*/
protected $type;
public function setUp(): void
{
$this->type = new class() extends AbstractType {
};
}
public function testBuildForm(): void
{
$builder = $this->createMock(FormBuilderInterface::class);
$this->assertNull($this->type->buildForm($builder, []));
}
public function testConfigureOptions(): void
{
$resolver = $this->createMock(OptionsResolver::class);
$this->assertNull($this->type->configureOptions($resolver));
}
}