Skip to content

Commit cf17736

Browse files
committed
test: gate intl-dependent support tests and suggest ext-intl
1 parent f7e05a8 commit cf17736

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@
225225
"hypervel/sentry": "self.version"
226226
},
227227
"suggest": {
228+
"ext-intl": "Required to use number formatting and spellout features.",
228229
"hypervel/redis": "Required to use redis driver. (^0.4).",
229230
"hypervel/session": "Required to use session guard. (^3.1).",
230231
"friendsofhyperf/tinker": "Required to use the tinker console command (^3.1).",

src/support/composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
"dev-main": "0.4-dev"
5252
}
5353
},
54+
"suggest": {
55+
"ext-intl": "Required to use number formatting and spellout features."
56+
},
5457
"config": {
5558
"sort-packages": true
5659
},

tests/Support/SupportNumberTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public function testFormatWithAppLocale()
9494
Number::useLocale('en');
9595
}
9696

97+
#[RequiresPhpExtension('intl')]
9798
public function testSpellout()
9899
{
99100
$this->assertSame('ten', Number::spell(10));
@@ -121,6 +122,7 @@ public function testSpelloutWithThreshold()
121122
$this->assertSame('100,000', Number::spell(100000, until: 50000));
122123
}
123124

125+
#[RequiresPhpExtension('intl')]
124126
public function testOrdinal()
125127
{
126128
$this->assertSame('1st', Number::ordinal(1));
@@ -191,6 +193,7 @@ public function testToCurrencyWithDifferentLocale()
191193
$this->assertSame('1 234,56 $US', Number::currency(1234.56, 'USD', 'fr'));
192194
}
193195

196+
#[RequiresPhpExtension('intl')]
194197
public function testBytesToHuman()
195198
{
196199
$this->assertSame('0 B', Number::fileSize(0));
@@ -219,6 +222,7 @@ public function testClamp()
219222
$this->assertSame(1, Number::clamp(-10, 1, 5));
220223
}
221224

225+
#[RequiresPhpExtension('intl')]
222226
public function testToHuman()
223227
{
224228
$this->assertSame('1', Number::forHumans(1));
@@ -275,6 +279,7 @@ public function testToHuman()
275279
$this->assertSame('-1 thousand quadrillion', Number::forHumans(-1000000000000000000));
276280
}
277281

282+
#[RequiresPhpExtension('intl')]
278283
public function testSummarize()
279284
{
280285
$this->assertSame('1', Number::abbreviate(1));

tests/Support/SupportStrTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use LogicException;
1313
use Override;
1414
use PHPUnit\Framework\Attributes\DataProvider;
15+
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
1516
use Ramsey\Uuid\Uuid;
1617
use Ramsey\Uuid\UuidInterface;
1718
use Symfony\Component\Uid\Ulid;
@@ -1941,6 +1942,7 @@ public function testReplaceMatches()
19411942
$this->assertSame('foo baZ baz bar', $result);
19421943
}
19431944

1945+
#[RequiresPhpExtension('intl')]
19441946
public function testPlural(): void
19451947
{
19461948
$this->assertSame('Laracon', Str::plural('Laracon', 1));

0 commit comments

Comments
 (0)