@@ -635,20 +635,32 @@ public function testSetValues(): void
635
635
// test with a specific limit that is lower than the number of replacements
636
636
$ templateProcessor = new TestableTemplateProcesor ($ mainPart );
637
637
$ templateProcessor ->setValues (['firstname ' => 'Jane ' , 'lastname ' => 'Smith ' ], 2 );
638
+ $ variablesCounts = $ templateProcessor ->getVariableCount ();
639
+
638
640
self ::assertStringContainsString ('Hello Jane Smith ' , $ templateProcessor ->getMainPart ());
639
641
self ::assertStringContainsString ('Hello ${firstname} ${lastname} ' , $ templateProcessor ->getMainPart ());
642
+ self ::assertEquals (1 , $ variablesCounts ['firstname ' ]);
643
+ self ::assertEquals (1 , $ variablesCounts ['lastname ' ]);
640
644
641
645
// test with a limit for only one replacement
642
646
$ templateProcessor = new TestableTemplateProcesor ($ mainPart );
643
647
$ templateProcessor ->setValues (['firstname ' => 'Alice ' , 'lastname ' => 'Wonderland ' ], 1 );
648
+ $ variablesCounts = $ templateProcessor ->getVariableCount ();
649
+
644
650
self ::assertStringContainsString ('Hello Alice Wonderland ' , $ templateProcessor ->getMainPart ());
645
651
self ::assertStringContainsString ('Hello ${firstname} ${lastname} ' , $ templateProcessor ->getMainPart ());
652
+ self ::assertEquals (2 , $ variablesCounts ['firstname ' ]);
653
+ self ::assertEquals (2 , $ variablesCounts ['lastname ' ]);
646
654
647
655
// Test with a limit of 0 for a result with no replacements
648
656
$ templateProcessor = new TestableTemplateProcesor ($ mainPart );
649
657
$ templateProcessor ->setValues (['firstname ' => 'Test ' , 'lastname ' => 'User ' ], 0 );
658
+ $ variablesCounts = $ templateProcessor ->getVariableCount ();
659
+
650
660
self ::assertStringContainsString ('Hello ${firstname} ${lastname} ' , $ templateProcessor ->getMainPart ());
651
661
self ::assertStringNotContainsString ('Hello Test User ' , $ templateProcessor ->getMainPart ());
662
+ self ::assertEquals (3 , $ variablesCounts ['firstname ' ]);
663
+ self ::assertEquals (3 , $ variablesCounts ['lastname ' ]);
652
664
}
653
665
654
666
/**
0 commit comments