detail pages for customers and projects (#1371)

This commit is contained in:
Kevin Papst
2020-01-16 16:25:28 +01:00
committed by GitHub
parent 28c5357f11
commit 6a44dbfe83
131 changed files with 3055 additions and 1742 deletions

View File

@@ -0,0 +1,46 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Tests\Form\Extension;
use App\Form\Extension\DocumentationLinkExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* @covers \App\Form\Extension\DocumentationLinkExtension
*/
class DocumentationLinkExtensionTest extends TestCase
{
public function testExtendedTypes()
{
self::assertEquals([FormType::class], DocumentationLinkExtension::getExtendedTypes());
}
public function testConfigureOptions()
{
$resolver = new OptionsResolver();
$sut = new DocumentationLinkExtension();
$sut->configureOptions($resolver);
self::assertEquals(['docu_chapter'], $resolver->getDefinedOptions());
self::assertTrue($resolver->hasDefault('docu_chapter'));
self::assertFalse($resolver->isRequired('docu_chapter'));
$result = $resolver->resolve(['docu_chapter' => 'foo']);
self::assertEquals(['docu_chapter' => 'foo'], $result);
$result = $resolver->resolve([]);
self::assertEquals(['docu_chapter' => ''], $result);
$this->expectException(InvalidOptionsException::class);
$resolver->resolve(['docu_chapter' => true]);
}
}

View File

@@ -0,0 +1,42 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Tests\Form\Extension;
use App\Form\Extension\EnhancedChoiceTypeExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* @covers \App\Form\Extension\EnhancedChoiceTypeExtension
*/
class EnhancedChoiceTypeExtensionTest extends TestCase
{
public function testExtendedTypes()
{
self::assertEquals([EntityType::class, ChoiceType::class], EnhancedChoiceTypeExtension::getExtendedTypes());
}
public function testConfigureOptions()
{
$resolver = new OptionsResolver();
$sut = new EnhancedChoiceTypeExtension();
$sut->configureOptions($resolver);
self::assertEquals(['selectpicker', 'search'], $resolver->getDefinedOptions());
self::assertTrue($resolver->hasDefault('selectpicker'));
self::assertTrue($resolver->hasDefault('search'));
self::assertFalse($resolver->isRequired('selectpicker'));
self::assertFalse($resolver->isRequired('search'));
$result = $resolver->resolve([]);
self::assertEquals(['selectpicker' => true, 'search' => true], $result);
}
}

View File

@@ -0,0 +1,46 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Tests\Form\Extension;
use App\Form\Extension\IconExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* @covers \App\Form\Extension\IconExtension
*/
class IconExtensionTest extends TestCase
{
public function testExtendedTypes()
{
self::assertEquals([TextType::class], IconExtension::getExtendedTypes());
}
public function testConfigureOptions()
{
$resolver = new OptionsResolver();
$sut = new IconExtension();
$sut->configureOptions($resolver);
self::assertEquals(['icon'], $resolver->getDefinedOptions());
self::assertTrue($resolver->hasDefault('icon'));
self::assertFalse($resolver->isRequired('icon'));
$result = $resolver->resolve(['icon' => 'foo']);
self::assertEquals(['icon' => 'foo'], $result);
$result = $resolver->resolve([]);
self::assertEquals(['icon' => ''], $result);
$this->expectException(InvalidOptionsException::class);
$resolver->resolve(['icon' => true]);
}
}