Skip to content

Commit dc6e6e4

Browse files
committed
minor #2507 [TwigComponent][Docs] add explicit string cast on string assertions (Valmonzo)
This PR was merged into the 2.x branch. Discussion ---------- [TwigComponent][Docs] add explicit string cast on string assertions | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Issues | <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT Following the examples from the documentation, I realized that if we use the `TestLiveComponent::render` method in `assertStringContainsString` and if we use strict types, then it throw an error because we try to assert a `RenderedComponent` object instead of a string. I think that explicitly adding the cast can help. Commits ------- 1a77c94 [TwigComponent][Docs] add explicit string cast on string assertions
2 parents f1b645e + 1a77c94 commit dc6e6e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/TwigComponent/doc/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ You can test how your component is mounted and rendered using the
13421342
data: ['foo' => 'bar'],
13431343
);
13441344

1345-
$this->assertStringContainsString('bar', $rendered);
1345+
$this->assertStringContainsString('bar', (string) $rendered);
13461346

13471347
// use the crawler
13481348
$this->assertCount(5, $rendered->crawler()->filter('ul li'));
@@ -1360,7 +1360,7 @@ You can test how your component is mounted and rendered using the
13601360
],
13611361
);
13621362

1363-
$this->assertStringContainsString('bar', $rendered);
1363+
$this->assertStringContainsString('bar', (string) $rendered);
13641364
}
13651365
}
13661366

0 commit comments

Comments
 (0)