fix html in tests descriptions and datasets

This commit is contained in:
faissaloux
2023-11-07 17:35:42 +01:00
parent 0a680dd06e
commit 95ec0a82b2
3 changed files with 13 additions and 2 deletions

View File

@ -193,6 +193,7 @@ trait Testable
$method = TestSuite::getInstance()->tests->get(self::$__filename)->getMethod($this->name()); $method = TestSuite::getInstance()->tests->get(self::$__filename)->getMethod($this->name());
$description = $this->dataName() ? $method->description.' with '.$this->dataName() : $method->description; $description = $this->dataName() ? $method->description.' with '.$this->dataName() : $method->description;
$description = htmlspecialchars(html_entity_decode($description), ENT_NOQUOTES);
if ($method->repetitions > 1) { if ($method->repetitions > 1) {
$matches = []; $matches = [];

View File

@ -99,3 +99,13 @@ it('shows the correct description for arrays with many elements', function () {
expect($descriptions[0])->toBe('([1, 2, 3, …])'); expect($descriptions[0])->toBe('([1, 2, 3, …])');
}); });
it('shows the correct description of datasets with html', function () {
$descriptions = array_keys(DatasetsRepository::resolve([
[
'<div class="flex items-center"></div>',
],
], __FILE__));
expect($descriptions[0])->toBe('(\'<div class="flex items-center"></div>\')');
});

View File

@ -20,7 +20,7 @@ $names = [
'卜竹弓一十山' => '__pest_evaluable_卜竹弓一十山', '卜竹弓一十山' => '__pest_evaluable_卜竹弓一十山',
'アゴデヸ' => '__pest_evaluable_アゴデヸ', 'アゴデヸ' => '__pest_evaluable_アゴデヸ',
'!p8VrB' => '__pest_evaluable__p8VrB', '!p8VrB' => '__pest_evaluable__p8VrB',
'&xe6VeKWF#n4' => '__pest_evaluable__xe6VeKWF_n4', '&amp;xe6VeKWF#n4' => '__pest_evaluable__amp_xe6VeKWF_n4',
'%%HurHUnw7zM!' => '__pest_evaluable___HurHUnw7zM_', '%%HurHUnw7zM!' => '__pest_evaluable___HurHUnw7zM_',
'rundeliekend' => '__pest_evaluable_rundeliekend', 'rundeliekend' => '__pest_evaluable_rundeliekend',
'g%%c!Jt9$fy#Kf' => '__pest_evaluable_g__c_Jt9_fy_Kf', 'g%%c!Jt9$fy#Kf' => '__pest_evaluable_g__c_Jt9_fy_Kf',
@ -33,7 +33,7 @@ $names = [
'Каролин' => '__pest_evaluable_Каролин', 'Каролин' => '__pest_evaluable_Каролин',
'অ্যান্টার্কটিকা' => '__pest_evaluable_অ্যান্টার্কটিকা', 'অ্যান্টার্কটিকা' => '__pest_evaluable_অ্যান্টার্কটিকা',
'Frýdek-Místek"' => '__pest_evaluable_Frýdek_Místek_', 'Frýdek-Místek"' => '__pest_evaluable_Frýdek_Místek_',
'Allingåbro&' => '__pest_evaluable_Allingåbro_', 'Allingåbro&amp;' => '__pest_evaluable_Allingåbro_amp_',
'Κεντροαφρικανική Δημοκρατία' => '__pest_evaluable_Κεντροαφρικανική_Δημοκρατία', 'Κεντροαφρικανική Δημοκρατία' => '__pest_evaluable_Κεντροαφρικανική_Δημοκρατία',
'آذربایجان غربی' => '__pest_evaluable_آذربایجان_غربی', 'آذربایجان غربی' => '__pest_evaluable_آذربایجان_غربی',
'זימבבואה' => '__pest_evaluable_זימבבואה', 'זימבבואה' => '__pest_evaluable_זימבבואה',