Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ca503a6

Browse filesBrowse files
authored
Support FontAwesome 7 (#25)
1 parent d28a49c commit ca503a6
Copy full SHA for ca503a6

6 files changed

+52-15Lines changed: 52 additions & 15 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/ci.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/ci.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
include:
7474
- php-version: '8.2'
7575
dependencies: low
76-
- php-version: '8.5'
76+
- php-version: '8.6'
7777
dependencies: dev
7878

7979
steps:
Collapse file

‎composer.json‎

Copy file name to clipboardExpand all lines: composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"require": {
1313
"php": ">= 8.2",
1414
"composer-runtime-api": "^2.1",
15-
"fortawesome/font-awesome": "^6.6",
15+
"fortawesome/font-awesome": "^6.7 || ^7.1",
1616
"symfony/dependency-injection": "^7.2 || ^8",
1717
"symfony/deprecation-contracts": "^2.5 || ^3",
1818
"symfony/filesystem": "^7.2 || ^8",
Collapse file

‎tests/TwigAwesomeTest.php‎

Copy file name to clipboardExpand all lines: tests/TwigAwesomeTest.php
+26-1Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Rabus\TwigAwesomeBundle;
66

7+
use Composer\InstalledVersions;
8+
use Composer\Semver\VersionParser;
79
use PHPUnit\Framework\TestCase;
810
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
911
use Symfony\Bundle\TwigBundle\TwigBundle;
@@ -27,12 +29,30 @@ protected function tearDown(): void
2729
$fs->remove(__DIR__.'/temp');
2830
}
2931

32+
public function testNodeIsConvertedToSvgLegacy(): void
33+
{
34+
$twig = $this->createTwigInstance();
35+
36+
if (!self::isFontAwesome6()) {
37+
self::markTestSkipped('This test is for FontAwesome 6.7 only.');
38+
}
39+
40+
self::assertStringMatchesFormatFile(
41+
__DIR__.'/fixtures/flag-6.7.html',
42+
$twig->render('flag.html.twig')
43+
);
44+
}
45+
3046
public function testNodeIsConvertedToSvg(): void
3147
{
3248
$twig = $this->createTwigInstance();
3349

50+
if (self::isFontAwesome6()) {
51+
self::markTestSkipped('This test is for FontAwesome 7.1 or newer only.');
52+
}
53+
3454
self::assertStringMatchesFormatFile(
35-
__DIR__.'/fixtures/flag.html',
55+
__DIR__.'/fixtures/flag-7.1.html',
3656
$twig->render('flag.html.twig')
3757
);
3858
}
@@ -84,4 +104,9 @@ protected function getContainerClass(): string
84104

85105
return $twig;
86106
}
107+
108+
private static function isFontAwesome6(): bool
109+
{
110+
return InstalledVersions::satisfies(new VersionParser(), 'fortawesome/font-awesome', '^6.7');
111+
}
87112
}
Collapse file

‎tests/fixtures/flag-6.7.html‎

Copy file name to clipboard
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<html>
2+
<head>
3+
<style type="text/css">
4+
.icons svg {
5+
height: 10em;
6+
}
7+
</style>
8+
</head>
9+
<body>
10+
<div class="icons"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--%A--><path d="M48 24C48 10.7 37.3 0 24 0S0 10.7 0 24L0 64 0 350.5 0 400l0 88c0 13.3 10.7 24 24 24s24-10.7 24-24l0-100 80.3-20.1c41.1-10.3 84.6-5.5 122.5 13.4c44.2 22.1 95.5 24.8 141.7 7.4l34.7-13c12.5-4.7 20.8-16.6 20.8-30l0-279.7c0-23-24.2-38-44.8-27.7l-9.6 4.8c-46.3 23.2-100.8 23.2-147.1 0c-35.1-17.6-75.4-22-113.5-12.5L48 52l0-28zm0 77.5l96.6-24.2c27-6.7 55.5-3.6 80.4 8.8c54.9 27.4 118.7 29.7 175 6.8l0 241.8-24.4 9.1c-33.7 12.6-71.2 10.7-103.4-5.4c-48.2-24.1-103.3-30.1-155.6-17.1L48 338.5l0-237z"/></svg></div>
11+
</body>
12+
</html>
Collapse file

‎tests/fixtures/flag-7.1.html‎

Copy file name to clipboard
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<html>
2+
<head>
3+
<style type="text/css">
4+
.icons svg {
5+
height: 10em;
6+
}
7+
</style>
8+
</head>
9+
<body>
10+
<div class="icons"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--%A--><path fill="currentColor" d="M48 24C48 10.7 37.3 0 24 0S0 10.7 0 24L0 488c0 13.3 10.7 24 24 24s24-10.7 24-24l0-100 80.3-20.1c41.1-10.3 84.6-5.5 122.5 13.4 44.2 22.1 95.5 24.8 141.7 7.4l34.7-13c12.5-4.7 20.8-16.6 20.8-30l0-279.7c0-23-24.2-38-44.8-27.7l-9.6 4.8c-46.3 23.2-100.8 23.2-147.1 0-35.1-17.6-75.4-22-113.5-12.5L48 52 48 24zm0 77.5l96.6-24.2c27-6.7 55.5-3.6 80.4 8.8 54.9 27.4 118.7 29.7 175 6.8l0 241.8-24.4 9.1c-33.7 12.6-71.2 10.7-103.4-5.4-48.2-24.1-103.3-30.1-155.6-17.1l-68.6 17.2 0-237z"/></svg></div>
11+
</body>
12+
</html>
Collapse file

‎tests/fixtures/flag.html‎

Copy file name to clipboardExpand all lines: tests/fixtures/flag.html
-12Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.