Skip to content

Commit

Permalink
Update tests to reflect new default ImgMaxLength
Browse files Browse the repository at this point in the history
  • Loading branch information
totten committed Dec 10, 2024
1 parent 381b255 commit d84d6f2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/HTMLPurifier/HTMLModule/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public function testNormal()

public function testLengthTooLarge()
{
$this->config->set('HTML.MaxImgLength', 1200);
$this->assertResult(
'<img height="40000" width="40000" src="" alt="" />',
'<img height="1200" width="1200" src="" alt="" />'
Expand All @@ -19,6 +20,7 @@ public function testLengthTooLarge()

public function testLengthPercentage()
{
$this->config->set('HTML.MaxImgLength', 1200);
$this->assertResult(
'<img height="100%" width="100%" src="" alt="" />',
'<img src="" alt="" />'
Expand Down
1 change: 1 addition & 0 deletions tests/HTMLPurifier/HTMLModule/SafeEmbedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class HTMLPurifier_HTMLModule_SafeEmbedTest extends HTMLPurifier_HTMLModuleHarne
public function setUp()
{
parent::setUp();
$this->config->set('HTML.MaxImgLength', 1200);
$def = $this->config->getHTMLDefinition(true);
$def->manager->addModule('SafeEmbed');
}
Expand Down
1 change: 1 addition & 0 deletions tests/HTMLPurifier/HTMLModule/SafeObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public function setUp()
parent::setUp();
$this->config->set('HTML.DefinitionID', 'HTMLPurifier_HTMLModule_SafeObjectTest');
$this->config->set('HTML.SafeObject', true);
$this->config->set('HTML.MaxImgLength', 1200);
}

public function testMinimal()
Expand Down
3 changes: 3 additions & 0 deletions tests/HTMLPurifier/Strategy/ValidateAttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public function testKeepAbsoluteCSSWidthAndHeightOnImg()

public function testRemoveLargeCSSWidthAndHeightOnImg()
{
$this->config->set('CSS.MaxImgLength', '1200px');
$this->assertResult(
'<img src="" alt="" style="width:10000000px;height:10000000px;border:1px solid #000;" />',
'<img src="" alt="" style="border:1px solid #000;" />'
Expand Down Expand Up @@ -244,6 +245,7 @@ public function testKeepPercentCSSWidthAndHeightOnImgWhenToldTo()

public function testRemoveRelativeCSSWidthAndHeightOnImg()
{
$this->config->set('CSS.MaxImgLength', '1200px');
$this->assertResult(
'<img src="" alt="" style="width:10em;height:10em;border:1px solid #000;" />',
'<img src="" alt="" style="border:1px solid #000;" />'
Expand All @@ -252,6 +254,7 @@ public function testRemoveRelativeCSSWidthAndHeightOnImg()

public function testRemovePercentCSSWidthAndHeightOnImg()
{
$this->config->set('CSS.MaxImgLength', '1200px');
$this->assertResult(
'<img src="" alt="" style="width:100%;height:100%;border:1px solid #000;" />',
'<img src="" alt="" style="border:1px solid #000;" />'
Expand Down

0 comments on commit d84d6f2

Please sign in to comment.