Skip to content

Commit 7021e18

Browse files
author
Jean-François Lépine
committed
minor fixes in test suite
1 parent aacf196 commit 7021e18

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
lines changed

src/Toolkit/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"twig/twig": "^2.12|^3.0",
3535
"symfony/console": "^7.2",
3636
"symfony/framework-bundle": "^6.4|^7.0",
37-
"symfony/phpunit-bridge": "^6.4|^7.0",
3837
"symfony/twig-bundle": "^6.4|^7.0",
3938
"symfony/ux-twig-component": "^2.22",
4039
"symfony/filesystem": "^7.2"
@@ -44,7 +43,8 @@
4443
"tales-from-a-dev/twig-tailwind-extra": "^0.3.0",
4544
"zenstruck/console-test": "^1.7",
4645
"symfony/http-client": "6.4|^7.0",
47-
"symfony/stopwatch": "^7.2"
46+
"symfony/stopwatch": "^7.2",
47+
"symfony/phpunit-bridge": "^6.4|^7.0"
4848
},
4949
"autoload": {
5050
"psr-4": {

src/Toolkit/phpunit.xml.dist

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
3-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" failOnRisky="true" failOnWarning="true" >
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
4+
backupGlobals="false"
5+
colors="true"
6+
bootstrap="tests/bootstrap.php"
7+
failOnRisky="true" failOnWarning="true"
8+
>
49
<php>
510
<ini name="display_errors" value="1"/>
611
<ini name="error_reporting" value="-1"/>
712
<server name="APP_ENV" value="test" force="true"/>
813
<server name="SHELL_VERBOSITY" value="-1"/>
914
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
1015
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5"/>
11-
<ini name="error_reporting" value="-1"/>
12-
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0&amp;max[direct]=0"/>
16+
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[total]=999999"/>
1317
<server name="KERNEL_CLASS" value="Symfony\UX\Toolkit\Tests\Fixtures\Kernel"/>
14-
<ini name="error_reporting" value="-1" />
15-
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0&amp;max[direct]=0"/>
1618
</php>
1719
<testsuites>
1820
<testsuite name="UX Toolkit Test Suite">

src/Toolkit/src/Compiler/TwigComponentCompiler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function compile(
4949
}
5050
}
5151

52-
private function installComponent(RegistryItem $item, string $directory, Filesystem $filesystem)
52+
private function installComponent(RegistryItem $item, string $directory, Filesystem $filesystem): void
5353
{
5454
if (RegistryItemType::Component !== $item->type) {
5555
return;
@@ -62,7 +62,7 @@ private function installComponent(RegistryItem $item, string $directory, Filesys
6262
]);
6363

6464
if ($filesystem->exists($filename)) {
65-
throw new TwigComponentAlreadyExist();
65+
throw new TwigComponentAlreadyExist("The component '{$item->name}' already exists.", 0, null);
6666
}
6767

6868
$filesystem->dumpFile($filename, $item->code);

src/Toolkit/tests/Compiler/TwigComponentCompilerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\UX\Toolkit\Tests\Compiler;
1313

14-
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
14+
use PHPUnit\Framework\TestCase;
1515
use Symfony\UX\Toolkit\Compiler\Exception\TwigComponentAlreadyExist;
1616
use Symfony\UX\Toolkit\Compiler\TwigComponentCompiler;
1717
use Symfony\UX\Toolkit\Registry\DependenciesResolver;
@@ -22,7 +22,7 @@
2222
/**
2323
* @author Jean-François Lépine
2424
*/
25-
class TwigComponentCompilerTest extends KernelTestCase
25+
class TwigComponentCompilerTest extends TestCase
2626
{
2727
public function testItShouldCompileComponentToFile(): void
2828
{

src/Toolkit/tests/bootstrap.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
use Symfony\Component\Filesystem\Filesystem;
13+
14+
require __DIR__.'/../vendor/autoload.php';
15+
16+
(new Filesystem())->remove(__DIR__.'/../var');

0 commit comments

Comments
 (0)