Skip to content

[TwigComponent][LiveComponent] Compatibility with Twig 2.9 / use_yield  #1390

Closed
@smnandre

Description

@smnandre

See twigphp/Twig#3950 (comment)

For now i test with a local clone of the fabpot branch, and use_yield hard coded / changed in Environment class

Status

Work in progress

  • Adapt TwigComponent code 90% OK
  • Adapt LiveComponent code

Todo/Later

  • Use PrintNode/CaptureNode/etc instead of "echo"

PHPUnit log

TwigComponent failures

Time: 00:00.312, Memory: 34.00 MB

There was 1 error:

1) Symfony\UX\TwigComponent\Tests\Integration\EmbeddedComponentTest::testANonEmbeddedComponentCanRenderParentBlocksAsFallback

--

There were 20 failures:

1) Symfony\UX\TwigComponent\Tests\Integration\ComponentEventTest::testTemplateIsUpdatedByEventListener with data set "TWIG component tag" ('{% component "FooBar:Baz" %}{...ent %}')

src/TwigComponent/tests/Integration/ComponentEventTest.php:40

2) Symfony\UX\TwigComponent\Tests\Integration\ComponentEventTest::testTemplateIsUpdatedByEventListener with data set "HTML open-close tag" ('<twig:FooBar:Baz></twig:FooBar:Baz>')

src/TwigComponent/tests/Integration/ComponentEventTest.php:40

3) Symfony\UX\TwigComponent\Tests\Integration\ComponentExtensionTest::testCanRenderComponentWithMoreAdvancedTwigExpressions

src/TwigComponent/tests/Integration/ComponentExtensionTest.php:57

4) Symfony\UX\TwigComponent\Tests\Integration\ComponentExtensionTest::testCanRenderEmbeddedComponent

src/TwigComponent/tests/Integration/ComponentExtensionTest.php:156

5) Symfony\UX\TwigComponent\Tests\Integration\ComponentExtensionTest::testComponentPropsOverwriteContextValue

src/TwigComponent/tests/Integration/ComponentExtensionTest.php:208

6) Symfony\UX\TwigComponent\Tests\Integration\ComponentLexerTest::testComponentSyntaxOpenTags

src/TwigComponent/tests/Integration/ComponentLexerTest.php:28

7) Symfony\UX\TwigComponent\Tests\Integration\ComponentLexerTest::testComponentSyntaxCanRenderEmbeddedComponent

src/TwigComponent/tests/Integration/ComponentLexerTest.php:44

8) Symfony\UX\TwigComponent\Tests\Integration\EmbeddedComponentTest::testAnEmbeddedComponentHasContextAccess

src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:183
src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:39

9) Symfony\UX\TwigComponent\Tests\Integration\EmbeddedComponentTest::testABlockIsOnlyPassedOneLevelDown

src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:183
src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:52

10) Symfony\UX\TwigComponent\Tests\Integration\EmbeddedComponentTest::testABlockIsNotPassedToNestedComponents

src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:183
src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:62

11) Symfony\UX\TwigComponent\Tests\Integration\EmbeddedComponentTest::testBlockCanBeUsedWithinNestedViaTheOuterBlocks

src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:183
src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:77

12) Symfony\UX\TwigComponent\Tests\Integration\EmbeddedComponentTest::testBlockCanBeUsedViaTheOuterBlocks

src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:183
src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:89

13) Symfony\UX\TwigComponent\Tests\Integration\EmbeddedComponentTest::testBlockDefinitionsPassingDownOuterBlocksOverrideDefaultContent

src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:183
src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:100

14) Symfony\UX\TwigComponent\Tests\Integration\EmbeddedComponentTest::testDeepNesting

src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:183
src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:111

15) Symfony\UX\TwigComponent\Tests\Integration\EmbeddedComponentTest::testItCanHandleMissingOuterBlocks

src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:183
src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:122

16) Symfony\UX\TwigComponent\Tests\Integration\EmbeddedComponentTest::testPassingDownBlocksMultipleLevelsNeedsToBeDoneManually

src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:183
src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:135

17) Symfony\UX\TwigComponent\Tests\Integration\EmbeddedComponentTest::testBlockDefinitionCanAccessTheContextOfTheDestinationBlocks

src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:183
src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:147

18) Symfony\UX\TwigComponent\Tests\Integration\EmbeddedComponentTest::testANonEmbeddedComponentRendersOuterBlocksEmpty

src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:183
src/TwigComponent/tests/Integration/EmbeddedComponentTest.php:161

19) Symfony\UX\TwigComponent\Tests\Integration\Test\InteractsWithTwigComponentsTest::testCanRenderComponentWithSlots with data set #0 ('WithSlots')

src/TwigComponent/tests/Integration/Test/InteractsWithTwigComponentsTest.php:73

20) Symfony\UX\TwigComponent\Tests\Integration\Test\InteractsWithTwigComponentsTest::testCanRenderComponentWithSlots with data set #1 ('Symfony\UX\TwigComponent\Test...hSlots')

src/TwigComponent/tests/Integration/Test/InteractsWithTwigComponentsTest.php:73

Legacy deprecation notices (4)
LiveComponent failures
Time: 00:04.753, Memory: 90.50 MB

There were 5 errors:

1) Symfony\UX\LiveComponent\Tests\Functional\EventListener\LiveComponentSubscriberTest::testItAddsEmbeddedTemplateContextToEmbeddedComponents
Behat\Mink\Exception\DriverException: There is no element matching XPath "//html"

src/LiveComponent/tests/Functional/EventListener/LiveComponentSubscriberTest.php:250

2) Symfony\UX\LiveComponent\Tests\Functional\Form\ComponentWithFormTest::testFormValuesRebuildAfterFormChanges
InvalidArgumentException: The current node list is empty.

src/LiveComponent/tests/Functional/Form/ComponentWithFormTest.php:44

3) Symfony\UX\LiveComponent\Tests\Functional\Form\ComponentWithFormTest::testFormRemembersValidationFromInitialForm
Twig\Error\RuntimeError: Calling "Twig\YieldingTemplate::displayBlock" for block "form" is not supported as "use_yield" is set to "true" in "@LiveComponent/form_theme.html.twig".

src/LiveComponent/tests/Functional/Form/ComponentWithFormTest.php:150

4) Symfony\UX\LiveComponent\Tests\Functional\Form\ComponentWithFormTest::testHandleCheckboxChanges
Twig\Error\RuntimeError: Calling "Twig\YieldingTemplate::displayBlock" for block "form_start" is not supported as "use_yield" is set to "true" in "@LiveComponent/form_theme.html.twig".

src/LiveComponent/tests/Functional/Form/ComponentWithFormTest.php:200

5) Symfony\UX\LiveComponent\Tests\Functional\Form\ComponentWithFormTest::testResetForm
Twig\Error\RuntimeError: Calling "Twig\YieldingTemplate::displayBlock" for block "form_start" is not supported as "use_yield" is set to "true" in "@LiveComponent/form_theme.html.twig".


--

There were 13 failures:

1) Symfony\UX\LiveComponent\Tests\Functional\EventListener\AddLiveAttributesSubscriberTest::testItAddsIdAndFingerprintToChildComponent

src/LiveComponent/tests/Functional/EventListener/AddLiveAttributesSubscriberTest.php:115

2) Symfony\UX\LiveComponent\Tests\Functional\EventListener\InterceptChildComponentRenderSubscriberTest::testItAllowsFullChildRenderOnMissingFingerprints
2 elements matching css "ul li" found on the page, but should be 3.

src/LiveComponent/tests/Functional/EventListener/InterceptChildComponentRenderSubscriberTest.php:39

3) Symfony\UX\LiveComponent\Tests\Functional\EventListener\InterceptChildComponentRenderSubscriberTest::testItRendersEmptyElementOnMatchingFingerprintBasic
2 elements matching css "ul li" found on the page, but should be 3.

src/LiveComponent/tests/Functional/EventListener/InterceptChildComponentRenderSubscriberTest.php:52

4) Symfony\UX\LiveComponent\Tests\Functional\EventListener\InterceptChildComponentRenderSubscriberTest::testItRendersEmptyElementOnMatchingFingerprintWithCustomDataLiveId
2 elements matching css "ul li" found on the page, but should be 3.

src/LiveComponent/tests/Functional/EventListener/InterceptChildComponentRenderSubscriberTest.php:69

5) Symfony\UX\LiveComponent\Tests\Functional\EventListener\InterceptChildComponentRenderSubscriberTest::testItRendersNewPropWhenFingerprintDoesNotMatch
2 elements matching css "ul li" found on the page, but should be 3.

src/LiveComponent/tests/Functional/EventListener/InterceptChildComponentRenderSubscriberTest.php:84

6) Symfony\UX\LiveComponent\Tests\Functional\EventListener\InterceptChildComponentRenderSubscriberTest::testItUsesKeysToRenderChildrenLiveIds
2 elements matching css "ul li" found on the page, but should be 3.

src/LiveComponent/tests/Functional/EventListener/InterceptChildComponentRenderSubscriberTest.php:130

7) Symfony\UX\LiveComponent\Tests\Functional\EventListener\LiveComponentSubscriberTest::testItWorksWithNamespacedTemplateNamesForEmbeddedComponents
Element matching css ".component2" not found.

src/LiveComponent/tests/Functional/EventListener/LiveComponentSubscriberTest.php:271

8) Symfony\UX\LiveComponent\Tests\Functional\EventListener\LiveComponentSubscriberTest::testItUseBlocksFromEmbeddedContextUsingMultipleComponents
The text "Overridden content from component 1" was not found in the text of the element matching css "#component1".

src/LiveComponent/tests/Functional/EventListener/LiveComponentSubscriberTest.php:297

9) Symfony\UX\LiveComponent\Tests\Functional\EventListener\LiveComponentSubscriberTest::testItUseBlocksFromEmbeddedContextUsingMultipleComponentsWithNamespacedTemplate
The text "Overridden content from component 1" was not found in the text of the element matching css "#component1".

src/LiveComponent/tests/Functional/EventListener/LiveComponentSubscriberTest.php:336

10) Symfony\UX\LiveComponent\Tests\Functional\Form\ComponentWithFormTest::testLiveCollectionTypeAddButtonsByDefault
The last request threw an exception: Twig\Error\RuntimeError - Calling "Twig\YieldingTemplate::displayBlock" for block "...n "@LiveComponent/form_theme.html.twig".

src/LiveComponent/tests/Functional/Form/ComponentWithFormTest.php:259

11) Symfony\UX\LiveComponent\Tests\Functional\Form\ComponentWithFormTest::testLiveCollectionTypeFieldsAddedAndRemoved
Current response status code is 400, but 422 expected.

src/LiveComponent/tests/Functional/Form/ComponentWithFormTest.php:342

12) Symfony\UX\LiveComponent\Tests\Functional\Form\ComponentWithFormTest::testDataModelAttributeAutomaticallyAdded
The last request threw an exception: Twig\Error\RuntimeError - Calling "Twig\YieldingTemplate::displayBlock" for block "...n "@LiveComponent/form_theme.html.twig".

src/LiveComponent/tests/Functional/Form/ComponentWithFormTest.php:402

13) Symfony\UX\LiveComponent\Tests\Integration\DataModelPropsSubscriberTest::testDataModelPropsAreAvailableInEmbeddedComponents
Failed asserting that '' contains "<textarea data-model="content">default content on mount</textarea>".

src/LiveComponent/tests/Integration/EventListener/DataModelPropsSubscriberTest.php:59

Remaining indirect deprecation notices (2)

  1x: SqliteSchemaManager::createDatabase() is deprecated. The engine will create the database file automatically. (SqliteSchemaManager.php:136 called by CreateDatabaseDoctrineCommand.php:84, https://github.com/doctrine/dbal/issues/4963, package doctrine/dbal)
    1x in LiveComponentSubscriberTest::_resetDatabase from Symfony\UX\LiveComponent\Tests\Functional\EventListener

  1x: Not configuring a schema manager factory is deprecated. Use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory which is going to be the default in DBAL 4. (Connection.php:221 called by DriverManager.php:197, https://github.com/doctrine/dbal/issues/5812, package doctrine/dbal)
    1x in LiveComponentSubscriberTest::_resetDatabase from Symfony\UX\LiveComponent\Tests\Functional\EventListener

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions