From 358f74f5860bc7075f2b3fdf20f9023a82bbc126 Mon Sep 17 00:00:00 2001 From: Olivier Laviale Date: Thu, 8 Aug 2024 00:39:36 +0200 Subject: [PATCH] Change tests namespace --- composer.json | 2 +- lib/Calendar.php | 6 +-- tests/Cache/CacheCollectionTest.php | 8 +++- tests/Cache/FileCacheTest.php | 6 ++- tests/Cache/RedisCacheTest.php | 3 +- tests/Cache/RunTimeCacheTest.php | 3 +- tests/Cache/TestCase.php | 2 +- tests/CalendarCollectionTest.php | 4 +- tests/CalendarTest.php | 47 ++++++++++--------- tests/ContextTransformsTest.php | 3 +- tests/CurrencyCollectionTest.php | 5 +- tests/CurrencyNotDefinedTest.php | 3 +- tests/CurrencyTest.php | 3 +- tests/DateFormatterTest.php | 5 +- tests/DateTimeAccessorTest.php | 3 +- tests/DateTimeFormatterTest.php | 6 ++- tests/GitHub/UrlResolverTest.php | 3 +- tests/ListFormatterTest.php | 3 +- tests/LocaleCollectionTest.php | 4 +- tests/LocaleIdTest.php | 3 +- tests/LocaleTest.php | 29 +++++++++--- tests/LocaleTest/LocalizableSample.php | 2 +- .../LocaleTest/LocalizedLocalizableSample.php | 2 +- tests/LocalizedCurrencyFormatterTest.php | 5 +- tests/LocalizedCurrencyTest.php | 9 +++- tests/LocalizedDateTimeTest.php | 7 ++- tests/LocalizedListFormatterTest.php | 5 +- tests/LocalizedLocaleTest.php | 5 +- tests/LocalizedNumberFormatterTest.php | 4 +- tests/LocalizedTerritoryTest.php | 4 +- tests/NumberFormatterTest.php | 3 +- tests/NumberPatternTest.php | 3 +- tests/NumberTest.php | 3 +- tests/NumbersTest.php | 3 +- tests/Plurals/OperandsTest.php | 3 +- tests/Plurals/RelationTest.php | 4 +- tests/Plurals/RuleTest.php | 3 +- tests/Plurals/SamplesTest.php | 3 +- tests/PluralsTest.php | 3 +- tests/Provider/WebProviderTest.php | 3 +- tests/RepositoryTest.php | 28 +++++++---- tests/StringHelpers.php | 4 +- tests/Supplemental/CurrencyDataTest.php | 6 ++- tests/Supplemental/FractionTest.php | 3 +- tests/SupplementalTest.php | 5 +- tests/TerritoryCollectionTest.php | 5 +- tests/TerritoryNotDefinedTest.php | 3 +- tests/TerritoryTest.php | 5 +- tests/TimeFormatterTest.php | 5 +- tests/Units/NumberPerUnitTest.php | 8 ++-- tests/Units/NumberWithUnitTest.php | 8 ++-- tests/Units/SequenceTest.php | 3 +- tests/Units/UnitTest.php | 3 +- tests/UnitsTest.php | 5 +- tests/bootstrap.php | 9 ++-- 55 files changed, 219 insertions(+), 106 deletions(-) diff --git a/composer.json b/composer.json index 60f2392..57c97c1 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,7 @@ }, "autoload-dev": { "psr-4": { - "ICanBoogie\\CLDR\\": "tests" + "Test\\ICanBoogie\\CLDR\\": "tests" } } } diff --git a/lib/Calendar.php b/lib/Calendar.php index b3a2011..58b5b81 100644 --- a/lib/Calendar.php +++ b/lib/Calendar.php @@ -179,7 +179,7 @@ public function format_datetime( DateTimeInterface|int|string $datetime, string|DateTimeFormatLength $pattern_or_length_or_skeleton ): string { - return $this->datetime_formatter->format($datetime, $pattern_or_length_or_skeleton); + return $this->get_datetime_formatter()->format($datetime, $pattern_or_length_or_skeleton); } /** @@ -189,7 +189,7 @@ public function format_date( DateTimeInterface|int|string $datetime, string|DateTimeFormatLength $pattern_or_length_or_skeleton ): string { - return $this->date_formatter->format($datetime, $pattern_or_length_or_skeleton); + return $this->get_date_formatter()->format($datetime, $pattern_or_length_or_skeleton); } /** @@ -199,7 +199,7 @@ public function format_time( DateTimeInterface|int|string $datetime, string|DateTimeFormatLength $pattern_or_length_or_skeleton ): string { - return $this->time_formatter->format($datetime, $pattern_or_length_or_skeleton); + return $this->get_time_formatter()->format($datetime, $pattern_or_length_or_skeleton); } /** diff --git a/tests/Cache/CacheCollectionTest.php b/tests/Cache/CacheCollectionTest.php index 89ca303..ca8436c 100644 --- a/tests/Cache/CacheCollectionTest.php +++ b/tests/Cache/CacheCollectionTest.php @@ -9,10 +9,14 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Cache; +namespace Test\ICanBoogie\CLDR\Cache; use ICanBoogie\CLDR\Cache; -use const ICanBoogie\CLDR\CACHE_DIR; +use ICanBoogie\CLDR\Cache\CacheCollection; +use ICanBoogie\CLDR\Cache\FileCache; +use ICanBoogie\CLDR\Cache\RuntimeCache; + +use const Test\ICanBoogie\CLDR\CACHE_DIR; class CacheCollectionTest extends TestCase { diff --git a/tests/Cache/FileCacheTest.php b/tests/Cache/FileCacheTest.php index e5d0ef7..960523d 100644 --- a/tests/Cache/FileCacheTest.php +++ b/tests/Cache/FileCacheTest.php @@ -9,10 +9,12 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Cache; +namespace Test\ICanBoogie\CLDR\Cache; use ICanBoogie\CLDR\Cache; -use const ICanBoogie\CLDR\CACHE_DIR; +use ICanBoogie\CLDR\Cache\FileCache; + +use const Test\ICanBoogie\CLDR\CACHE_DIR; class FileCacheTest extends TestCase { diff --git a/tests/Cache/RedisCacheTest.php b/tests/Cache/RedisCacheTest.php index 3ef77ec..aa33b4c 100644 --- a/tests/Cache/RedisCacheTest.php +++ b/tests/Cache/RedisCacheTest.php @@ -9,9 +9,10 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Cache; +namespace Test\ICanBoogie\CLDR\Cache; use ICanBoogie\CLDR\Cache; +use ICanBoogie\CLDR\Cache\RedisCache; use Redis; class RedisCacheTest extends TestCase diff --git a/tests/Cache/RunTimeCacheTest.php b/tests/Cache/RunTimeCacheTest.php index ee2048d..8e0563c 100644 --- a/tests/Cache/RunTimeCacheTest.php +++ b/tests/Cache/RunTimeCacheTest.php @@ -9,9 +9,10 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Cache; +namespace Test\ICanBoogie\CLDR\Cache; use ICanBoogie\CLDR\Cache; +use ICanBoogie\CLDR\Cache\RuntimeCache; class RunTimeCacheTest extends TestCase { diff --git a/tests/Cache/TestCase.php b/tests/Cache/TestCase.php index 33b994c..9b22c36 100644 --- a/tests/Cache/TestCase.php +++ b/tests/Cache/TestCase.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Cache; +namespace Test\ICanBoogie\CLDR\Cache; use ICanBoogie\CLDR\Cache; use function uniqid; diff --git a/tests/CalendarCollectionTest.php b/tests/CalendarCollectionTest.php index c91c652..345bc8c 100644 --- a/tests/CalendarCollectionTest.php +++ b/tests/CalendarCollectionTest.php @@ -9,9 +9,11 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; use BadMethodCallException; +use ICanBoogie\CLDR\Calendar; +use ICanBoogie\CLDR\CalendarCollection; use ICanBoogie\OffsetNotWritable; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/CalendarTest.php b/tests/CalendarTest.php index 3ab08e7..c836369 100644 --- a/tests/CalendarTest.php +++ b/tests/CalendarTest.php @@ -9,27 +9,33 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; - +namespace Test\ICanBoogie\CLDR; + +use ICanBoogie\CLDR\Calendar; +use ICanBoogie\CLDR\DateFormatter; +use ICanBoogie\CLDR\DateTimeFormatLength; +use ICanBoogie\CLDR\DateTimeFormatter; +use ICanBoogie\CLDR\Locale; +use ICanBoogie\CLDR\TimeFormatter; use ICanBoogie\PropertyNotDefined; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class CalendarTest extends TestCase { - private static Calendar $calendar; + private static Calendar $sut; public static function setupBeforeClass(): void { - self::$calendar = locale_for('fr')->calendars['gregorian']; // @phpstan-ignore-line + self::$sut = locale_for('fr')->calendars['gregorian']; // @phpstan-ignore-line } #[DataProvider('provider_test_property_instanceof')] public function test_property_instanceof(string $property, string $expected): void { - $instance = self::$calendar->$property; + $instance = self::$sut->$property; $this->assertInstanceOf($expected, $instance); // @phpstan-ignore-line - $this->assertSame($instance, self::$calendar->$property); + $this->assertSame($instance, self::$sut->$property); } /** @@ -50,13 +56,13 @@ public static function provider_test_property_instanceof(): array public function test_get_undefined_property(): void { $this->expectException(PropertyNotDefined::class); - self::$calendar->undefined_property; // @phpstan-ignore-line + self::$sut->undefined_property; // @phpstan-ignore-line } #[DataProvider('provide_test_access')] public function test_access(string $key): void { - $this->assertTrue(self::$calendar->offsetExists($key)); + $this->assertTrue(self::$sut->offsetExists($key)); } /** @@ -82,13 +88,13 @@ public static function provide_test_access(): array public function test_date_patterns_shortcuts(string $property, string $path): void { $path_parts = explode('/', $path); - $expected = self::$calendar; + $expected = self::$sut; foreach ($path_parts as $part) { $expected = $expected[$part]; } - $this->assertEquals(self::$calendar->$property, $expected); + $this->assertEquals(self::$sut->$property, $expected); } /** @@ -136,25 +142,22 @@ public static function provide_test_date_patterns_shortcuts(): array public function testFormatDateTime(): void { - $this->assertSame( - self::$calendar->format_datetime('2018-11-24 20:12:22 UTC', DateTimeFormatLength::FULL), - "samedi 24 novembre 2018 à 20:12:22 UTC" - ); + $actual = self::$sut->format_datetime('2018-11-24 20:12:22 UTC', DateTimeFormatLength::FULL); + + $this->assertSame("samedi 24 novembre 2018 à 20:12:22 UTC", $actual); } public function testFormatDate(): void { - $this->assertSame( - self::$calendar->format_date('2018-11-24 20:12:22 UTC', DateTimeFormatLength::LONG), - "24 novembre 2018" - ); + $actual = self::$sut->format_date('2018-11-24 20:12:22 UTC', DateTimeFormatLength::LONG); + + $this->assertSame("24 novembre 2018", $actual); } public function testFormatTime(): void { - $this->assertSame( - self::$calendar->format_time('2018-11-24 20:12:22 UTC', DateTimeFormatLength::LONG), - "20:12:22 UTC" - ); + $actual = self::$sut->format_time('2018-11-24 20:12:22 UTC', DateTimeFormatLength::LONG); + + $this->assertSame("20:12:22 UTC", $actual); } } diff --git a/tests/ContextTransformsTest.php b/tests/ContextTransformsTest.php index 39637a2..b25e3b6 100644 --- a/tests/ContextTransformsTest.php +++ b/tests/ContextTransformsTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\ContextTransforms; use LogicException; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/CurrencyCollectionTest.php b/tests/CurrencyCollectionTest.php index ba65840..63e6f66 100644 --- a/tests/CurrencyCollectionTest.php +++ b/tests/CurrencyCollectionTest.php @@ -9,8 +9,11 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\Currency; +use ICanBoogie\CLDR\CurrencyCollection; +use ICanBoogie\CLDR\CurrencyNotDefined; use ICanBoogie\OffsetNotWritable; use PHPUnit\Framework\TestCase; diff --git a/tests/CurrencyNotDefinedTest.php b/tests/CurrencyNotDefinedTest.php index bed8649..e8f40d8 100644 --- a/tests/CurrencyNotDefinedTest.php +++ b/tests/CurrencyNotDefinedTest.php @@ -9,9 +9,10 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; use Exception; +use ICanBoogie\CLDR\CurrencyNotDefined; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/CurrencyTest.php b/tests/CurrencyTest.php index c944d14..6c3b3a8 100644 --- a/tests/CurrencyTest.php +++ b/tests/CurrencyTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\Currency; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/DateFormatterTest.php b/tests/DateFormatterTest.php index 68d004a..180586f 100644 --- a/tests/DateFormatterTest.php +++ b/tests/DateFormatterTest.php @@ -9,8 +9,11 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\DateFormatter; +use ICanBoogie\CLDR\DateTimeFormatId; +use ICanBoogie\CLDR\DateTimeFormatLength; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/DateTimeAccessorTest.php b/tests/DateTimeAccessorTest.php index 895a839..0bd1839 100644 --- a/tests/DateTimeAccessorTest.php +++ b/tests/DateTimeAccessorTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\DateTimeAccessor; use LogicException; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/DateTimeFormatterTest.php b/tests/DateTimeFormatterTest.php index 4fe9551..123f84d 100644 --- a/tests/DateTimeFormatterTest.php +++ b/tests/DateTimeFormatterTest.php @@ -9,8 +9,12 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\Calendar; +use ICanBoogie\CLDR\DateTimeFormatId; +use ICanBoogie\CLDR\DateTimeFormatLength; +use ICanBoogie\CLDR\DateTimeFormatter; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/GitHub/UrlResolverTest.php b/tests/GitHub/UrlResolverTest.php index adfd43a..3dd4cce 100644 --- a/tests/GitHub/UrlResolverTest.php +++ b/tests/GitHub/UrlResolverTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\GitHub; +namespace Test\ICanBoogie\CLDR\GitHub; +use ICanBoogie\CLDR\GitHub\UrlResolver; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/ListFormatterTest.php b/tests/ListFormatterTest.php index fa453b6..d68ff99 100644 --- a/tests/ListFormatterTest.php +++ b/tests/ListFormatterTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\ListFormatter; use ICanBoogie\CLDR\Locale\ListPattern; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/LocaleCollectionTest.php b/tests/LocaleCollectionTest.php index ba1836f..0359cf5 100644 --- a/tests/LocaleCollectionTest.php +++ b/tests/LocaleCollectionTest.php @@ -9,9 +9,11 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; use BadMethodCallException; +use ICanBoogie\CLDR\Locale; +use ICanBoogie\CLDR\LocaleCollection; use ICanBoogie\OffsetNotWritable; use InvalidArgumentException; use PHPUnit\Framework\TestCase; diff --git a/tests/LocaleIdTest.php b/tests/LocaleIdTest.php index d2ab550..80304e5 100644 --- a/tests/LocaleIdTest.php +++ b/tests/LocaleIdTest.php @@ -1,7 +1,8 @@ warm_up(function() use (&$n) { $n++; }); - $this->assertEquals(30, $n); + $this->assertEquals(31, $n); } } diff --git a/tests/LocaleTest/LocalizableSample.php b/tests/LocaleTest/LocalizableSample.php index 52ef7d7..87d7ada 100644 --- a/tests/LocaleTest/LocalizableSample.php +++ b/tests/LocaleTest/LocalizableSample.php @@ -1,6 +1,6 @@ localize($locale_id); + $actual = $localized->format($number, LocalizedCurrencyFormatter::PATTERN_ACCOUNTING); - $this->assertStringSame($expected, $localized->format($number, LocalizedCurrencyFormatter::PATTERN_ACCOUNTING)); + $this->assertStringSame($expected, $actual); } /** diff --git a/tests/LocalizedDateTimeTest.php b/tests/LocalizedDateTimeTest.php index f471498..2b17b32 100644 --- a/tests/LocalizedDateTimeTest.php +++ b/tests/LocalizedDateTimeTest.php @@ -9,9 +9,14 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; use DateTime; +use ICanBoogie\CLDR\DateTimeFormatId; +use ICanBoogie\CLDR\DateTimeFormatLength; +use ICanBoogie\CLDR\DateTimeFormatter; +use ICanBoogie\CLDR\Locale; +use ICanBoogie\CLDR\LocalizedDateTime; use ICanBoogie\PropertyNotReadable; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/LocalizedListFormatterTest.php b/tests/LocalizedListFormatterTest.php index ea07fb8..2163120 100644 --- a/tests/LocalizedListFormatterTest.php +++ b/tests/LocalizedListFormatterTest.php @@ -9,8 +9,11 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\ListFormatter; +use ICanBoogie\CLDR\ListType; +use ICanBoogie\CLDR\LocalizedListFormatter; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/LocalizedLocaleTest.php b/tests/LocalizedLocaleTest.php index c80ab9b..9c66747 100644 --- a/tests/LocalizedLocaleTest.php +++ b/tests/LocalizedLocaleTest.php @@ -9,8 +9,11 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\Locale; +use ICanBoogie\CLDR\LocaleId; +use ICanBoogie\CLDR\LocalizedLocale; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/LocalizedNumberFormatterTest.php b/tests/LocalizedNumberFormatterTest.php index 3f7dda8..12367d1 100644 --- a/tests/LocalizedNumberFormatterTest.php +++ b/tests/LocalizedNumberFormatterTest.php @@ -9,8 +9,10 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\LocalizedNumberFormatter; +use ICanBoogie\CLDR\NumberFormatter; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/LocalizedTerritoryTest.php b/tests/LocalizedTerritoryTest.php index 6a9987b..880917c 100644 --- a/tests/LocalizedTerritoryTest.php +++ b/tests/LocalizedTerritoryTest.php @@ -9,8 +9,10 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\LocalizedTerritory; +use ICanBoogie\CLDR\Territory; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/NumberFormatterTest.php b/tests/NumberFormatterTest.php index e1ed91f..4a3593f 100644 --- a/tests/NumberFormatterTest.php +++ b/tests/NumberFormatterTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\NumberFormatter; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/NumberPatternTest.php b/tests/NumberPatternTest.php index eb99010..5c603de 100644 --- a/tests/NumberPatternTest.php +++ b/tests/NumberPatternTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\NumberPattern; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/NumberTest.php b/tests/NumberTest.php index f06b2df..46a6a03 100644 --- a/tests/NumberTest.php +++ b/tests/NumberTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\Number; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/NumbersTest.php b/tests/NumbersTest.php index 54199f7..e4d1040 100644 --- a/tests/NumbersTest.php +++ b/tests/NumbersTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\Numbers; use ICanBoogie\CLDR\Numbers\Symbols; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/Plurals/OperandsTest.php b/tests/Plurals/OperandsTest.php index 3d688db..3138475 100644 --- a/tests/Plurals/OperandsTest.php +++ b/tests/Plurals/OperandsTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Plurals; +namespace Test\ICanBoogie\CLDR\Plurals; +use ICanBoogie\CLDR\Plurals\Operands; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/Plurals/RelationTest.php b/tests/Plurals/RelationTest.php index 90a0563..fa8a490 100644 --- a/tests/Plurals/RelationTest.php +++ b/tests/Plurals/RelationTest.php @@ -9,8 +9,10 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Plurals; +namespace Test\ICanBoogie\CLDR\Plurals; +use ICanBoogie\CLDR\Plurals\Operands; +use ICanBoogie\CLDR\Plurals\Relation; use PHPUnit\Framework\TestCase; /** diff --git a/tests/Plurals/RuleTest.php b/tests/Plurals/RuleTest.php index c781dbf..2fe6276 100644 --- a/tests/Plurals/RuleTest.php +++ b/tests/Plurals/RuleTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Plurals; +namespace Test\ICanBoogie\CLDR\Plurals; +use ICanBoogie\CLDR\Plurals\Rule; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/Plurals/SamplesTest.php b/tests/Plurals/SamplesTest.php index 6d3b3ae..68576e6 100644 --- a/tests/Plurals/SamplesTest.php +++ b/tests/Plurals/SamplesTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Plurals; +namespace Test\ICanBoogie\CLDR\Plurals; +use ICanBoogie\CLDR\Plurals\Samples; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/PluralsTest.php b/tests/PluralsTest.php index b7fc161..8d62810 100644 --- a/tests/PluralsTest.php +++ b/tests/PluralsTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\Plurals; use ICanBoogie\CLDR\Plurals\Samples; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/Provider/WebProviderTest.php b/tests/Provider/WebProviderTest.php index 88a1aad..01e5cdb 100644 --- a/tests/Provider/WebProviderTest.php +++ b/tests/Provider/WebProviderTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Provider; +namespace Test\ICanBoogie\CLDR\Provider; +use ICanBoogie\CLDR\Provider\WebProvider; use ICanBoogie\CLDR\ResourceNotFound; use PHPUnit\Framework\TestCase; diff --git a/tests/RepositoryTest.php b/tests/RepositoryTest.php index 8b48f13..fbad24d 100644 --- a/tests/RepositoryTest.php +++ b/tests/RepositoryTest.php @@ -9,29 +9,37 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\CurrencyCollection; +use ICanBoogie\CLDR\CurrencyFormatter; +use ICanBoogie\CLDR\ListFormatter; use ICanBoogie\CLDR\Locale\ListPattern; -use PHPUnit\Framework\Assert; +use ICanBoogie\CLDR\NumberFormatter; +use ICanBoogie\CLDR\Plurals; +use ICanBoogie\CLDR\Provider; +use ICanBoogie\CLDR\Repository; +use ICanBoogie\CLDR\Supplemental; +use ICanBoogie\CLDR\TerritoryCollection; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; final class RepositoryTest extends TestCase { - private Repository $repository; + private Repository $sut; protected function setUp(): void { - $this->repository = get_repository(); + $this->sut = get_repository(); } #[DataProvider('provide_test_properties_instanceof')] public function test_properties_instanceof(string $property, string $expected): void { - $repository = $this->repository; - $instance = $repository->$property; + $sut = $this->sut; + $instance = $sut->$property; $this->assertInstanceOf($expected, $instance); - $this->assertSame($instance, $repository->$property); + $this->assertSame($instance, $sut->$property); } /** @@ -57,7 +65,7 @@ public function test_format_number(): void { $this->assertSame( "4,123.37", - $this->repository->format_number(4123.37, "#,#00.#0") + $this->sut->format_number(4123.37, "#,#00.#0") ); } @@ -65,7 +73,7 @@ public function test_format_currency(): void { $this->assertSame( "$4,123.37", - $this->repository->format_currency(4123.37, "¤#,#00.#0", null, '$') + $this->sut->format_currency(4123.37, "¤#,#00.#0", null, '$') ); } @@ -81,6 +89,6 @@ public function test_format_list(): void ]); - $this->assertSame("one, two, and three", $this->repository->format_list($list, $list_pattern)); + $this->assertSame("one, two, and three", $this->sut->format_list($list, $list_pattern)); } } diff --git a/tests/StringHelpers.php b/tests/StringHelpers.php index 0bf5dbb..6990127 100644 --- a/tests/StringHelpers.php +++ b/tests/StringHelpers.php @@ -1,6 +1,6 @@ assertSame( $expected, diff --git a/tests/Supplemental/CurrencyDataTest.php b/tests/Supplemental/CurrencyDataTest.php index ccf60d4..30ec0e1 100644 --- a/tests/Supplemental/CurrencyDataTest.php +++ b/tests/Supplemental/CurrencyDataTest.php @@ -9,11 +9,13 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Supplemental; +namespace Test\ICanBoogie\CLDR\Supplemental; +use ICanBoogie\CLDR\Supplemental\CurrencyData; +use ICanBoogie\CLDR\Supplemental\Fraction; use PHPUnit\Framework\TestCase; -use function ICanBoogie\CLDR\get_repository; +use function Test\ICanBoogie\CLDR\get_repository; final class CurrencyDataTest extends TestCase { diff --git a/tests/Supplemental/FractionTest.php b/tests/Supplemental/FractionTest.php index d19fee5..49620b7 100644 --- a/tests/Supplemental/FractionTest.php +++ b/tests/Supplemental/FractionTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Supplemental; +namespace Test\ICanBoogie\CLDR\Supplemental; +use ICanBoogie\CLDR\Supplemental\Fraction; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/SupplementalTest.php b/tests/SupplementalTest.php index 02ad1fc..0aaa165 100644 --- a/tests/SupplementalTest.php +++ b/tests/SupplementalTest.php @@ -9,8 +9,9 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\Supplemental; use ICanBoogie\CLDR\Supplemental\CurrencyData; use ICanBoogie\OffsetNotDefined; use ICanBoogie\OffsetNotWritable; @@ -128,6 +129,6 @@ public function test_warm_up(): void self::$sut->warm_up(function() use (&$n) { $n++; }); - $this->assertEquals(28, $n); + $this->assertEquals(29, $n); } } diff --git a/tests/TerritoryCollectionTest.php b/tests/TerritoryCollectionTest.php index c9769fe..c59daef 100644 --- a/tests/TerritoryCollectionTest.php +++ b/tests/TerritoryCollectionTest.php @@ -9,8 +9,11 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\Territory; +use ICanBoogie\CLDR\TerritoryCollection; +use ICanBoogie\CLDR\TerritoryNotDefined; use ICanBoogie\OffsetNotWritable; use PHPUnit\Framework\TestCase; diff --git a/tests/TerritoryNotDefinedTest.php b/tests/TerritoryNotDefinedTest.php index 6bce9f0..690b45f 100644 --- a/tests/TerritoryNotDefinedTest.php +++ b/tests/TerritoryNotDefinedTest.php @@ -9,9 +9,10 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; use Exception; +use ICanBoogie\CLDR\TerritoryNotDefined; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/TerritoryTest.php b/tests/TerritoryTest.php index 359fdd0..43dea94 100644 --- a/tests/TerritoryTest.php +++ b/tests/TerritoryTest.php @@ -9,8 +9,11 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\LocaleId; +use ICanBoogie\CLDR\LocalizedTerritory; +use ICanBoogie\CLDR\Territory; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/TimeFormatterTest.php b/tests/TimeFormatterTest.php index b889ff1..dc67e32 100644 --- a/tests/TimeFormatterTest.php +++ b/tests/TimeFormatterTest.php @@ -9,8 +9,11 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\DateTimeFormatId; +use ICanBoogie\CLDR\DateTimeFormatLength; +use ICanBoogie\CLDR\TimeFormatter; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/Units/NumberPerUnitTest.php b/tests/Units/NumberPerUnitTest.php index 1063664..8579528 100644 --- a/tests/Units/NumberPerUnitTest.php +++ b/tests/Units/NumberPerUnitTest.php @@ -9,15 +9,15 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Units; +namespace Test\ICanBoogie\CLDR\Units; -use ICanBoogie\CLDR\LocaleId; -use ICanBoogie\CLDR\StringHelpers; use ICanBoogie\CLDR\UnitLength; use ICanBoogie\CLDR\Units; +use ICanBoogie\CLDR\Units\NumberPerUnit; use PHPUnit\Framework\TestCase; +use Test\ICanBoogie\CLDR\StringHelpers; -use function ICanBoogie\CLDR\locale_for; +use function Test\ICanBoogie\CLDR\locale_for; final class NumberPerUnitTest extends TestCase { diff --git a/tests/Units/NumberWithUnitTest.php b/tests/Units/NumberWithUnitTest.php index 86d0942..baf75b1 100644 --- a/tests/Units/NumberWithUnitTest.php +++ b/tests/Units/NumberWithUnitTest.php @@ -9,15 +9,15 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Units; +namespace Test\ICanBoogie\CLDR\Units; -use ICanBoogie\CLDR\LocaleId; -use ICanBoogie\CLDR\StringHelpers; use ICanBoogie\CLDR\UnitLength; use ICanBoogie\CLDR\Units; +use ICanBoogie\CLDR\Units\NumberWithUnit; use PHPUnit\Framework\TestCase; +use Test\ICanBoogie\CLDR\StringHelpers; -use function ICanBoogie\CLDR\locale_for; +use function Test\ICanBoogie\CLDR\locale_for; final class NumberWithUnitTest extends TestCase { diff --git a/tests/Units/SequenceTest.php b/tests/Units/SequenceTest.php index 42f5cdb..0abad36 100644 --- a/tests/Units/SequenceTest.php +++ b/tests/Units/SequenceTest.php @@ -9,10 +9,11 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Units; +namespace Test\ICanBoogie\CLDR\Units; use ICanBoogie\CLDR\UnitLength; use ICanBoogie\CLDR\Units; +use ICanBoogie\CLDR\Units\Sequence; use PHPUnit\Framework\TestCase; final class SequenceTest extends TestCase diff --git a/tests/Units/UnitTest.php b/tests/Units/UnitTest.php index 2cd5359..3327a8a 100644 --- a/tests/Units/UnitTest.php +++ b/tests/Units/UnitTest.php @@ -9,10 +9,11 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR\Units; +namespace Test\ICanBoogie\CLDR\Units; use ICanBoogie\CLDR\UnitLength; use ICanBoogie\CLDR\Units; +use ICanBoogie\CLDR\Units\Unit; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/UnitsTest.php b/tests/UnitsTest.php index 4728fc7..278800e 100644 --- a/tests/UnitsTest.php +++ b/tests/UnitsTest.php @@ -9,8 +9,11 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; +use ICanBoogie\CLDR\Spaces; +use ICanBoogie\CLDR\UnitLength; +use ICanBoogie\CLDR\Units; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 84ee901..75e2a26 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -9,14 +9,18 @@ * file that was distributed with this source code. */ -namespace ICanBoogie\CLDR; +namespace Test\ICanBoogie\CLDR; use ICanBoogie\CLDR\Cache\CacheCollection; use ICanBoogie\CLDR\Cache\FileCache; use ICanBoogie\CLDR\Cache\RedisCache; use ICanBoogie\CLDR\Cache\RuntimeCache; +use ICanBoogie\CLDR\Locale; +use ICanBoogie\CLDR\LocaleId; +use ICanBoogie\CLDR\Provider; use ICanBoogie\CLDR\Provider\CachedProvider; use ICanBoogie\CLDR\Provider\WebProvider; +use ICanBoogie\CLDR\Repository; use Redis; use function getenv; @@ -64,8 +68,7 @@ function get_repository(): Repository { static $repository; - return $repository - ?? $repository = new Repository(create_provider()); + return $repository ??= new Repository(create_provider()); } function locale_for(string|LocaleId $id): Locale