Skip to content

Commit b2abaab

Browse files
committed
wip
1 parent 59a7b4f commit b2abaab

File tree

2 files changed

+28
-29
lines changed

2 files changed

+28
-29
lines changed

src/Toolkit/src/Kit/KitSynchronizer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ private function synchronizeComponents(Kit $kit): void
6969
;
7070

7171
foreach ($finder as $file) {
72-
$relativePathNameToKit = $file->getRelativePathname();
73-
$relativePathName = str_replace($componentsPath.'/', '', Path::normalize($relativePathNameToKit));
72+
$relativePathNameToKit = Path::normalize($file->getRelativePathname());
73+
$relativePathName = str_replace($componentsPath.'/', '', $relativePathNameToKit);
7474
$componentName = $this->extractComponentName($relativePathName);
7575

7676
$meta = null;
@@ -161,8 +161,8 @@ private function synchronizeStimulusControllers(Kit $kit): void
161161
;
162162

163163
foreach ($finder as $file) {
164-
$relativePathNameToKit = $file->getRelativePathname();
165-
$relativePathName = str_replace($controllersPath.\DIRECTORY_SEPARATOR, '', $relativePathNameToKit);
164+
$relativePathNameToKit = Path::normalize($file->getRelativePathname());
165+
$relativePathName = str_replace($controllersPath.'/', '', $relativePathNameToKit);
166166
$controllerName = $this->extractStimulusControllerName($relativePathName);
167167
$controller = new StimulusController(
168168
name: $controllerName,

src/Toolkit/tests/Command/DebugKitCommandTest.php

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\UX\Toolkit\Tests\Command;
1313

1414
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
15+
use Symfony\Component\Filesystem\Path;
1516
use Zenstruck\Console\Test\InteractsWithConsole;
1617

1718
class DebugKitCommandTest extends KernelTestCase
@@ -21,36 +22,34 @@ class DebugKitCommandTest extends KernelTestCase
2122
public function testShouldBeAbleToDebug(): void
2223
{
2324
$this->bootKernel();
24-
$this->consoleCommand(\sprintf('ux:toolkit:debug-kit %s', __DIR__.'/../../kits/shadcn'))
25-
->execute()
25+
$this->consoleCommand(\sprintf('ux:toolkit:debug-kit %s', Path::join(__DIR__, '/../../kits/shadcn')))
26+
->execute()
2627
->assertSuccessful()
2728
// Kit details
2829
->assertOutputContains('Name Shadcn')
2930
->assertOutputContains('Homepage https://ux.symfony.com/components')
3031
->assertOutputContains('License MIT')
3132
// Components details
32-
->assertOutputContains(<<<'EOF'
33-
+--------------+----------------------- Component: "Avatar" --------------------------------------+
34-
| File(s) | templates/components/Avatar.html.twig |
35-
| Dependencies | tales-from-a-dev/twig-tailwind-extra |
36-
| | Avatar:Image |
37-
| | Avatar:Text |
38-
+--------------+----------------------------------------------------------------------------------+
39-
EOF
40-
)
41-
->assertOutputContains(<<<'EOF'
42-
+--------------+----------------------- Component: "Table" ---------------------------------------+
43-
| File(s) | templates/components/Table.html.twig |
44-
| Dependencies | tales-from-a-dev/twig-tailwind-extra |
45-
| | Table:Body |
46-
| | Table:Caption |
47-
| | Table:Cell |
48-
| | Table:Footer |
49-
| | Table:Head |
50-
| | Table:Header |
51-
| | Table:Row |
52-
+--------------+----------------------------------------------------------------------------------+
53-
EOF
54-
);
33+
->assertOutputContains(implode(PHP_EOL, [
34+
'+--------------+----------------------- Component: "Avatar" --------------------------------------+',
35+
'| File(s) | templates/components/Avatar.html.twig |',
36+
'| Dependencies | tales-from-a-dev/twig-tailwind-extra |',
37+
'| | Avatar:Image |',
38+
'| | Avatar:Text |',
39+
'+--------------+----------------------------------------------------------------------------------+',
40+
]))
41+
->assertOutputContains(implode(PHP_EOL, [
42+
'+--------------+----------------------- Component: "Table" ---------------------------------------+',
43+
'| File(s) | templates/components/Table.html.twig |',
44+
'| Dependencies | tales-from-a-dev/twig-tailwind-extra |',
45+
'| | Table:Body |',
46+
'| | Table:Caption |',
47+
'| | Table:Cell |',
48+
'| | Table:Footer |',
49+
'| | Table:Head |',
50+
'| | Table:Header |',
51+
'| | Table:Row |',
52+
'+--------------+----------------------------------------------------------------------------------+',
53+
]));
5554
}
5655
}

0 commit comments

Comments
 (0)