|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the PackageFactory.AtomicFusion.PresentationObjects package |
| 5 | + */ |
| 6 | + |
| 7 | +declare(strict_types=1); |
| 8 | + |
| 9 | +namespace PackageFactory\AtomicFusion\PresentationObjects\Tests\Unit\Domain; |
| 10 | + |
| 11 | +use Neos\Flow\Tests\UnitTestCase; |
| 12 | +use PackageFactory\AtomicFusion\PresentationObjects\Domain\Component\Component; |
| 13 | +use PackageFactory\AtomicFusion\PresentationObjects\Domain\Component\ComponentName; |
| 14 | +use PackageFactory\AtomicFusion\PresentationObjects\Domain\DummyFactoryRenderer; |
| 15 | +use PackageFactory\AtomicFusion\PresentationObjects\Domain\FusionNamespace; |
| 16 | +use PackageFactory\AtomicFusion\PresentationObjects\Domain\PackageKey; |
| 17 | +use PackageFactory\AtomicFusion\PresentationObjects\Domain\Component\Props; |
| 18 | +use PHPUnit\Framework\Assert; |
| 19 | + |
| 20 | +/** |
| 21 | + * Test cases for DummyFactoryRenderer |
| 22 | + */ |
| 23 | +class DummyFactoryRendererTest extends UnitTestCase |
| 24 | +{ |
| 25 | + private ?Component $component = null; |
| 26 | + |
| 27 | + public function setUp(): void |
| 28 | + { |
| 29 | + parent::setUp(); |
| 30 | + |
| 31 | + $componentName = new ComponentName( |
| 32 | + new PackageKey('Vendor.Site'), |
| 33 | + FusionNamespace::default(), |
| 34 | + 'MyNewComponent', |
| 35 | + ); |
| 36 | + $this->component = new Component( |
| 37 | + $componentName, |
| 38 | + Props::fromInputArray( |
| 39 | + $componentName, |
| 40 | + [ |
| 41 | + 'bool:bool', |
| 42 | + 'nullableBool:?bool', |
| 43 | + 'float:float', |
| 44 | + 'nullableFloat:?float', |
| 45 | + 'int:int', |
| 46 | + 'nullableInt:?int', |
| 47 | + 'string:string', |
| 48 | + 'nullableString:?string', |
| 49 | + 'uri:Uri', |
| 50 | + 'nullableUri:?Uri', |
| 51 | + 'image:ImageSource', |
| 52 | + 'nullableImage:?ImageSource', |
| 53 | + 'subComponent:MyComponent', |
| 54 | + 'nullableSubComponent:?MyComponent', |
| 55 | + 'componentArray:array<MyComponent>', |
| 56 | + 'enum:MyStringEnum', |
| 57 | + 'nullableEnum:?MyStringEnum', |
| 58 | + 'slot:slot', |
| 59 | + 'nullableSlot:?slot', |
| 60 | + ] |
| 61 | + ) |
| 62 | + ); |
| 63 | + } |
| 64 | + |
| 65 | + public function testGetFactoryContent(): void |
| 66 | + { |
| 67 | + Assert::assertSame( |
| 68 | + '<?php |
| 69 | +
|
| 70 | +/* |
| 71 | + * This file is part of the Vendor.Site package. |
| 72 | + */ |
| 73 | +
|
| 74 | +declare(strict_types=1); |
| 75 | +
|
| 76 | +namespace Vendor\Site\Presentation\Component\MyNewComponent; |
| 77 | +
|
| 78 | +use PackageFactory\AtomicFusion\PresentationObjects\Fusion\AbstractComponentPresentationObjectFactory; |
| 79 | +
|
| 80 | +final class MyNewComponentFactory extends AbstractComponentPresentationObjectFactory |
| 81 | +{ |
| 82 | +} |
| 83 | +', |
| 84 | + (new DummyFactoryRenderer())->renderFactoryContent($this->component) |
| 85 | + ); |
| 86 | + } |
| 87 | +} |
0 commit comments