[TESTS] Expand test coverage for App\Util\Forms\ArrayTransformer, App\Util\Notification and App\Twig\Runtime

This commit is contained in:
2021-05-05 13:37:10 +00:00
parent 6591d78a9c
commit fbe0f36a53
5 changed files with 66 additions and 4 deletions

View File

@@ -20,19 +20,25 @@
namespace App\Tests\Util\Form;
use App\Util\Form\ArrayTransformer;
use Jchook\AssertThrows\AssertThrows;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Form\Exception\TransformationFailedException;
class ArrayTransformerTest extends WebTestCase
{
use AssertThrows;
public function testTransform()
{
static::assertSame('', (new ArrayTransformer)->transform([]));
static::assertSame('foo bar quux', (new ArrayTransformer)->transform(['foo', 'bar', 'quux']));
static::assertThrows(TransformationFailedException::class, fn () => (new ArrayTransformer)->transform(''));
}
public function testReverseTransform()
{
static::assertSame([], (new ArrayTransformer)->reverseTransform(''));
static::assertSame(['foo', 'bar', 'quux'], (new ArrayTransformer)->reverseTransform('foo bar quux'));
static::assertThrows(TransformationFailedException::class, fn () => (new ArrayTransformer)->reverseTransform(1));
}
}