Skip to content

Commit

Permalink
[TASK] Add some basic ComposerPackageManager tests
Browse files Browse the repository at this point in the history
This change adds some basic package info resolving
tests using `ext:core`, which is always available
and most likely will not vanish.

Releases: main, 7
  • Loading branch information
sbuerk committed May 11, 2023
1 parent 91e010f commit 8897cbb
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Tests/Unit/Composer/ComposerPackageManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

use TYPO3\TestingFramework\Composer\ComposerPackageManager;
use TYPO3\TestingFramework\Composer\PackageInfo;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;

final class ComposerPackageManagerTest extends UnitTestCase
Expand Down Expand Up @@ -142,4 +143,46 @@ public function sanitizePathReturnsExpectedValue(string $path, string $expectedP
$subject = new ComposerPackageManager();
self::assertSame($expectedPath, $subject->sanitizePath($path));
}

/**
* @test
*/
public function coreExtensionCanBeResolvedByExtensionKey(): void
{
$subject = new ComposerPackageManager();
$packageInfo = $subject->getPackageInfo('core');

self::assertInstanceOf(PackageInfo::class, $packageInfo);
self::assertSame('typo3/cms-core', $packageInfo->getName());
self::assertSame('core', $packageInfo->getExtensionKey());
self::assertTrue($packageInfo->isSystemExtension());
}

/**
* @test
*/
public function coreExtensionCanBeResolvedByPackageName(): void
{
$subject = new ComposerPackageManager();
$packageInfo = $subject->getPackageInfo('typo3/cms-core');

self::assertInstanceOf(PackageInfo::class, $packageInfo);
self::assertSame('typo3/cms-core', $packageInfo->getName());
self::assertSame('core', $packageInfo->getExtensionKey());
self::assertTrue($packageInfo->isSystemExtension());
}

/**
* @test
*/
public function coreExtensionCanBeResolvedWithRelativeLegacyPathPrefix(): void
{
$subject = new ComposerPackageManager();
$packageInfo = $subject->getPackageInfo('typo3/sysext/core');

self::assertInstanceOf(PackageInfo::class, $packageInfo);
self::assertSame('typo3/cms-core', $packageInfo->getName());
self::assertSame('core', $packageInfo->getExtensionKey());
self::assertTrue($packageInfo->isSystemExtension());
}
}

0 comments on commit 8897cbb

Please sign in to comment.