Skip to content

Commit 962163d

Browse files
author
Bernhard Schmitt
committed
WIP: Adjust tests
1 parent ae310e5 commit 962163d

108 files changed

Lines changed: 360 additions & 1769 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Classes/Domain/Component/Component.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function getClassContent(): string
3333
use PackageFactory\AtomicFusion\PresentationObjects\Fusion\AbstractComponentPresentationObject;
3434
' . $this->props->renderUseStatements() . '
3535
#[Flow\Proxy(false)]
36-
final class ' . $this->name->getSimpleClassName() . ' extends AbstractComponentPresentationObject
36+
final readonly class ' . $this->name->getSimpleClassName() . ' extends AbstractComponentPresentationObject
3737
{
3838
' . $this->renderConstructor() . '
3939
}
@@ -53,28 +53,25 @@ public function getComponentArrayContent(): string
5353
use Neos\Flow\Annotations as Flow;
5454
5555
/**
56-
* @implements \IteratorAggregate<int,' . $this->name->getSimpleClassName() . '>
56+
* @implements \IteratorAggregate<' . $this->name->getSimpleClassName() . '>
5757
*/
5858
#[Flow\Proxy(false)]
59-
final class ' . $this->name->getSimpleComponentArrayName() . ' implements \IteratorAggregate, \Countable
59+
final readonly class ' . $this->name->getSimpleComponentArrayName() . ' implements \IteratorAggregate, \Countable
6060
{
6161
/**
62-
* @var array<int,' . $this->name->getSimpleClassName() . '>
62+
* @var array<' . $this->name->getSimpleClassName() . '>
6363
*/
6464
private array $' . $this->name->getSimpleComponentArrayPropertyName() . ';
6565
66-
/**
67-
* @param array<int,' . $this->name->getSimpleInterfaceName() . '> $array
68-
*/
6966
public function __construct(' . $this->name->getSimpleClassName() . ' ...$' . $this->name->getSimpleComponentArrayPropertyName() . ')
7067
{
7168
$this->' . $this->name->getSimpleComponentArrayPropertyName() . ' = $' . $this->name->getSimpleComponentArrayPropertyName() . ';
7269
}
7370
7471
/**
75-
* @return \ArrayIterator<int,' . $this->name->getSimpleClassName() . '>|' . $this->name->getSimpleClassName() . '[]
72+
* @return \Iterator<' . $this->name->getSimpleClassName() . '>
7673
*/
77-
public function getIterator(): \ArrayIterator
74+
public function getIterator(): \Iterator
7875
{
7976
return new \ArrayIterator($this->' . $this->name->getSimpleComponentArrayPropertyName() . ');
8077
}
@@ -117,7 +114,7 @@ private function renderConstructor(): string
117114
{
118115
$arguments = [];
119116
foreach ($this->props as $propName => $propType) {
120-
$arguments[] = 'public readonly ' . $propType->getType() . ' $' . $propName . ',';
117+
$arguments[] = 'public ' . $propType->getType() . ' $' . $propName . ',';
121118
}
122119
return 'public function __construct(
123120
' . trim(trim(implode("\n ", $arguments)), ',') . '

Classes/Domain/Component/PropType/ImageSourcePropType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#[Flow\Proxy(false)]
1515
final readonly class ImageSourcePropType implements PropTypeInterface
1616
{
17-
1817
public function __construct(
1918
private bool $nullable
2019
) {

Classes/Domain/Component/PropType/StringLikePropType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#[Flow\Proxy(false)]
1414
final readonly class StringLikePropType implements PropTypeInterface
1515
{
16-
1716
public function __construct(
1817
private bool $nullable
1918
) {

Classes/Fusion/IntComponentVariant.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ public function equals(int $other): bool
1818
return $this === self::from($other);
1919
}
2020

21-
public function allowsCallOfMethod(string $methodName): true
21+
/**
22+
* @param string $methodName
23+
*/
24+
public function allowsCallOfMethod($methodName): true
2225
{
2326
return true;
2427
}

Classes/Fusion/StringComponentVariant.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ public function equals(string $other): bool
1818
return $this === self::from($other);
1919
}
2020

21-
public function allowsCallOfMethod(string $methodName): true
21+
/**
22+
* @param string $methodName
23+
*/
24+
public function allowsCallOfMethod($methodName): true
2225
{
2326
return true;
2427
}

Documentation/01_PresentationObjectsAndComponents.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ declare(strict_types=1);
118118

119119
namespace Acme\Site\Presentation\Block\Headline;
120120

121+
use Neos\Eel\ProtectedContextAwareInterface;
121122
use PackageFactory\AtomicFusion\PresentationObjects\Fusion\StringComponentVariant;
122123

123-
enum HeadlineType:string
124+
enum HeadlineType:string implements ProtectedContextAwareInterface
124125
{
125126
use StringComponentVariant
126127

Documentation/04_IntegrationRecipes.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ declare(strict_types=1);
9595

9696
namespace Acme\Site\Presentation\Block\Headline;
9797

98+
use Neos\Eel\ProtectedContextAwareInterface;
9899
use PackageFactory\AtomicFusion\PresentationObjects\Fusion\StringComponentVariant;
99100

100-
enum HeadlineType:string
101+
enum HeadlineType:string implements ProtectedContextAwareInterface
101102
{
102103
use StringComponentVariant
103104

Documentation/05_Kickstarter.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ declare(strict_types=1);
5151

5252
namespace Vendor\Site\Presentation\Component\Headline;
5353

54+
use Neos\Eel\ProtectedContextAwareInterface;
5455
use PackageFactory\AtomicFusion\PresentationObjects\Fusion\StringComponentVariant;
5556

56-
enum HeadlineLook:string
57+
enum HeadlineLook:string implements ProtectedContextAwareInterface
5758
{
5859
use StringComponentVariant
5960

Tests/Unit/Domain/Component/ComponentGeneratorTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function setUpComponentGeneratorTest(): void
5959
/**
6060
* @return array<string,array{ComponentName,string[],string,bool,bool,string[]}>
6161
*/
62-
public function exampleProvider(): array
62+
public static function exampleProvider(): array
6363
{
6464
return [
6565
'text' => [
@@ -249,17 +249,12 @@ public function exampleProvider(): array
249249
}
250250

251251
/**
252-
* @test
253252
* @dataProvider exampleProvider
254-
* @param ComponentName $componentName
255253
* @param string[] $serializedProps
256-
* @param string $packagePath
257-
* @param bool $listable
258254
* @param string[] $expectedFileNames
259-
* @return void
260255
* @throws \Neos\Utility\Exception\FilesException
261256
*/
262-
public function generatesComponents(ComponentName $componentName, array $serializedProps, string $packagePath, bool $colocate, bool $listable, array $expectedFileNames): void
257+
public function testGeneratesComponents(ComponentName $componentName, array $serializedProps, string $packagePath, bool $colocate, bool $listable, array $expectedFileNames): void
263258
{
264259
$this->componentGenerator->generateComponent($componentName, $serializedProps, $packagePath, $colocate, $listable);
265260

Tests/Unit/Domain/Component/ComponentNameTest.php

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ final class ComponentNameTest extends UnitTestCase
2121
{
2222
/**
2323
* @dataProvider inputProvider
24-
* @param string $input
25-
* @param PackageKey $defaultPackageKey
26-
* @param ComponentName $expectedName
2724
*/
2825
public function testFromInput(string $input, PackageKey $defaultPackageKey, ComponentName $expectedName): void
2926
{
@@ -33,7 +30,7 @@ public function testFromInput(string $input, PackageKey $defaultPackageKey, Comp
3330
/**
3431
* @return array<array{string,PackageKey,ComponentName}>
3532
*/
36-
public function inputProvider(): array
33+
public static function inputProvider(): array
3734
{
3835
$defaultPackageKey = new PackageKey('Vendor.Default');
3936

@@ -63,9 +60,6 @@ public function inputProvider(): array
6360

6461
/**
6562
* @dataProvider classNameProvider
66-
* @param string $className
67-
* @param ComponentName $expectedName
68-
* @return void
6963
*/
7064
public function testFromClassName(string $className, ComponentName $expectedName): void
7165
{
@@ -75,7 +69,7 @@ public function testFromClassName(string $className, ComponentName $expectedName
7569
/**
7670
* @return array<mixed>
7771
*/
78-
public function classNameProvider(): array
72+
public static function classNameProvider(): array
7973
{
8074
$packageKey = new PackageKey('Vendor.Site');
8175
return [
@@ -104,7 +98,6 @@ public function classNameProvider(): array
10498

10599
/**
106100
* @dataProvider fusionPathProvider
107-
* @return void
108101
*/
109102
public function testFromFusionPath(string $className, ComponentName $expectedName): void
110103
{
@@ -114,7 +107,7 @@ public function testFromFusionPath(string $className, ComponentName $expectedNam
114107
/**
115108
* @return array<mixed>
116109
*/
117-
public function fusionPathProvider(): array
110+
public static function fusionPathProvider(): array
118111
{
119112
return [
120113
[
@@ -154,9 +147,6 @@ public function fusionPathProvider(): array
154147

155148
/**
156149
* @dataProvider fusionNameProvider
157-
* @param ComponentName $subject
158-
* @param string $expectedValue
159-
* @return void
160150
*/
161151
public function testGetFullyQualifiedFusionName(ComponentName $subject, string $expectedValue)
162152
{
@@ -166,7 +156,7 @@ public function testGetFullyQualifiedFusionName(ComponentName $subject, string $
166156
/**
167157
* @return array<mixed>
168158
*/
169-
public function fusionNameProvider(): array
159+
public static function fusionNameProvider(): array
170160
{
171161
return [
172162
[
@@ -186,9 +176,6 @@ public function fusionNameProvider(): array
186176

187177
/**
188178
* @dataProvider phpNamespaceProvider
189-
* @param ComponentName $subject
190-
* @param string $expectedValue
191-
* @return void
192179
*/
193180
public function testGetPhpNamespace(ComponentName $subject, string $expectedValue)
194181
{
@@ -198,7 +185,7 @@ public function testGetPhpNamespace(ComponentName $subject, string $expectedValu
198185
/**
199186
* @return array<mixed>
200187
*/
201-
public function phpNamespaceProvider(): array
188+
public static function phpNamespaceProvider(): array
202189
{
203190
return [
204191
[
@@ -218,9 +205,6 @@ public function phpNamespaceProvider(): array
218205

219206
/**
220207
* @dataProvider factoryNameProvider
221-
* @param ComponentName $subject
222-
* @param string $expectedValue
223-
* @return void
224208
*/
225209
public function testGetFullyQualifiedFactoryName(ComponentName $subject, string $expectedValue)
226210
{
@@ -230,7 +214,7 @@ public function testGetFullyQualifiedFactoryName(ComponentName $subject, string
230214
/**
231215
* @return array<mixed>
232216
*/
233-
public function factoryNameProvider(): array
217+
public static function factoryNameProvider(): array
234218
{
235219
return [
236220
[
@@ -250,9 +234,6 @@ public function factoryNameProvider(): array
250234

251235
/**
252236
* @dataProvider interfaceNameProvider
253-
* @param ComponentName $subject
254-
* @param string $expectedValue
255-
* @return void
256237
*/
257238
public function testGetFullyQualifiedInterfaceName(ComponentName $subject, string $expectedValue)
258239
{
@@ -262,7 +243,7 @@ public function testGetFullyQualifiedInterfaceName(ComponentName $subject, strin
262243
/**
263244
* @return array<mixed>
264245
*/
265-
public function interfaceNameProvider(): array
246+
public static function interfaceNameProvider(): array
266247
{
267248
return [
268249
[
@@ -282,9 +263,6 @@ public function interfaceNameProvider(): array
282263

283264
/**
284265
* @dataProvider helperNameProvider
285-
* @param ComponentName $subject
286-
* @param string $expectedValue
287-
* @return void
288266
*/
289267
public function testGetHelperName(ComponentName $subject, string $expectedValue)
290268
{
@@ -294,7 +272,7 @@ public function testGetHelperName(ComponentName $subject, string $expectedValue)
294272
/**
295273
* @return array<mixed>
296274
*/
297-
public function helperNameProvider(): array
275+
public static function helperNameProvider(): array
298276
{
299277
return [
300278
[
@@ -314,11 +292,6 @@ public function helperNameProvider(): array
314292

315293
/**
316294
* @dataProvider phpFilePathProvider
317-
* @param ComponentName $subject
318-
* @param string $packagePath
319-
* @param bool $colocate
320-
* @param string $expectedValue
321-
* @return void
322295
*/
323296
public function testGetPhpFilePath(ComponentName $subject, string $packagePath, bool $colocate, string $expectedValue)
324297
{
@@ -328,7 +301,7 @@ public function testGetPhpFilePath(ComponentName $subject, string $packagePath,
328301
/**
329302
* @return array<mixed>
330303
*/
331-
public function phpFilePathProvider(): array
304+
public static function phpFilePathProvider(): array
332305
{
333306
return [
334307
[
@@ -354,10 +327,6 @@ public function phpFilePathProvider(): array
354327

355328
/**
356329
* @dataProvider fusionFilePathProvider
357-
* @param ComponentName $subject
358-
* @param string $packagePath
359-
* @param string $expectedValue
360-
* @return void
361330
*/
362331
public function testGetFusionFilePath(ComponentName $subject, string $packagePath, string $expectedValue)
363332
{
@@ -367,7 +336,7 @@ public function testGetFusionFilePath(ComponentName $subject, string $packagePat
367336
/**
368337
* @return array<mixed>
369338
*/
370-
public function fusionFilePathProvider(): array
339+
public static function fusionFilePathProvider(): array
371340
{
372341
return [
373342
[

0 commit comments

Comments
 (0)