/
githubmirror
/
symfony
Обзор
Документация
Войти
/
githubmirror
/
symfony
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
8.2
src/Symfony/Component/AssetMapper/Tests/ImportMap/PackageUpdateInfoTest.php
67 строк
2 KB
Christian Flothmann
replace PHPUnit annotations with attributes
04 авг 2025, 10:05
04 авг 2025, 10:05
982f89c
Код
Авторство
О чём код?
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\AssetMapper\Tests\ImportMap; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\AssetMapper\ImportMap\PackageUpdateInfo; class PackageUpdateInfoTest extends TestCase { #[DataProvider('provideValidConstructorArguments')] public function testConstructor($importName, $currentVersion, $latestVersion, $updateType) { $packageUpdateInfo = new PackageUpdateInfo( packageName: $importName, currentVersion: $currentVersion, latestVersion: $latestVersion, updateType: $updateType, ); $this->assertSame($importName, $packageUpdateInfo->packageName); $this->assertSame($currentVersion, $packageUpdateInfo->currentVersion); $this->assertSame($latestVersion, $packageUpdateInfo->latestVersion); $this->assertSame($updateType, $packageUpdateInfo->updateType); } public static function provideValidConstructorArguments(): iterable { return [ ['@hotwired/stimulus', '5.2.1', 'string', 'downgrade'], ['@hotwired/stimulus', 'v3.2.1', '3.2.1', 'up-to-date'], ['@hotwired/stimulus', '3.0.0-beta', 'v1.0.0', 'major'], ['@hotwired/stimulus', 'string', null, null], ]; } #[DataProvider('provideHasUpdateArguments')] public function testHasUpdate($updateType, $expectUpdate) { $packageUpdateInfo = new PackageUpdateInfo( packageName: 'packageName', currentVersion: '1.0.0', updateType: $updateType, ); $this->assertSame($expectUpdate, $packageUpdateInfo->hasUpdate()); } public static function provideHasUpdateArguments(): iterable { return [ ['downgrade', false], ['up-to-date', false], ['major', true], ['minor', true], ['patch', true], ]; } }