Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"psr-4": {"Marcgoertz\\Shorten\\": "tests/"}
},
"scripts": {
"fix": "phpcbf --standard=PSR12 --ignore=vendor ./",
"lint": "phpcs --standard=PSR12 --ignore=vendor --no-cache ./",
"fix": "phpcbf --ignore=vendor .",
"lint": "phpcs --ignore=vendor --no-cache .",
"test": "phpunit"
},
"minimum-stability": "stable",
Expand All @@ -43,7 +43,7 @@
},
"require-dev": {
"phpunit/phpunit": "^11.3.1",
"squizlabs/php_codesniffer": "^3.6.0",
"squizlabs/php_codesniffer": "^4.0.0",
"php-coveralls/php-coveralls": "^2.4.3"
}
}
29 changes: 12 additions & 17 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions tests/ShortenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ public function testComplexAttributes(): void
'<a href="https://example.com?param=value&other=test" title="Link\'s title">Link text here</a>',
8
);
$this->assertEquals('<a href="https://example.com?param=value&other=test" title="Link\'s title">Link tex</a>…', $result);
$this->assertEquals(
'<a href="https://example.com?param=value&other=test" title="Link\'s title">Link tex</a>…',
$result
);
}

public function testTagsOnly(): void
Expand Down Expand Up @@ -288,7 +291,9 @@ public function testMixedContentScenarios(): void
$this->assertEquals('<p>Hello &amp; 世界 🌍 <strong>bo⋯</strong></p>', $result);

// Real-world complex example
$markup = '<article><h2>Title éléphant 🐘</h2><p>Paragraph with <a href="#">link &amp; more</a> content.</p></article>';
$markup =
'<article><h2>Title éléphant 🐘</h2>' .
'<p>Paragraph with <a href="#">link &amp; more</a> content.</p></article>';
$result = $this->shorten->truncateMarkup($markup, 20, '…', false, true);
$this->assertEquals('<article><h2>Title &eacute;l&eacute;phant</h2></article>…', $result);
}
Expand Down