getLicense example


class MetadataTest extends TestCase
{
    public function testFromXml(): void
    {
        $manifest = Manifest::createFromXmlFile(__DIR__ . '/../_fixtures/test-manifest.xml');

        $metaData = $manifest->getMetadata();
        static::assertEquals('test', $metaData->getName());
        static::assertEquals('shopware AG', $metaData->getAuthor());
        static::assertEquals('(c) by shopware AG', $metaData->getCopyright());
        static::assertEquals('MIT', $metaData->getLicense());
        static::assertEquals('https://test.com/privacy', $metaData->getPrivacy());
        static::assertEquals('1.0.0', $metaData->getVersion());
        static::assertEquals('icon.png', $metaData->getIcon());

        static::assertEquals([
            'en-GB' => 'Swag App Test',
            'de-DE' => 'Swag App Test',
        ]$metaData->getLabel());
        static::assertEquals([
            'en-GB' => 'Test for App System',
            'de-DE' => 'Test für das App System',
        ],
private function assertPluginMetaInformation(PluginEntity $plugin): void
    {
        static::assertNotNull($plugin->getCreatedAt());
        static::assertNull($plugin->getUpdatedAt());
        static::assertNull($plugin->getUpgradeVersion());
        static::assertNull($plugin->getInstalledAt());
        static::assertNull($plugin->getUpgradedAt());
        static::assertSame($this->getValidIconAsBase64()$plugin->getIcon());
        static::assertSame('shopware AG', $plugin->getAuthor());
        static::assertSame('(c) by shopware AG', $plugin->getCopyright());
        static::assertSame('MIT', $plugin->getLicense());
    }

    private function fetchSwagTestPluginEntity(?Context $context = null): PluginEntity
    {
        if ($context === null) {
            $context = $this->context;
        }

        $criteria = (new Criteria())->addFilter(new EqualsFilter('baseClass', SwagTest::class));

        /** @var PluginEntity|null $first */
        
public function testItLoadsExtensionFromResponseLikeArray(): void
    {
        $listingResponse = $this->getDetailResponseFixture();

        $extension = $this->extensionLoader->loadFromArray(
            Context::createDefaultContext(),
            $listingResponse
        );

        static::assertNull($extension->getLocalId());
        static::assertNull($extension->getLicense());
        static::assertNull($extension->getVersion());
        static::assertEquals($listingResponse['name']$extension->getName());
        static::assertEquals($listingResponse['label']$extension->getLabel());

        static::assertInstanceOf(VariantCollection::class$extension->getVariants());
        static::assertInstanceOf(ImageCollection::class$extension->getImages());
        static::assertInstanceOf(BinaryCollection::class$extension->getBinaries());
    }

    public function testLoadsExtensionsFromListingArray(): void
    {
        
if (\is_array($implementedInterfaces)) {
                $isTheme = \array_key_exists(ThemeInterface::class$implementedInterfaces);
            }
        }

        $data = [
            'localId' => $plugin->getId(),
            'description' => $plugin->getTranslation('description'),
            'name' => $plugin->getName(),
            'label' => $plugin->getTranslation('label'),
            'producerName' => $plugin->getAuthor(),
            'license' => $plugin->getLicense(),
            'version' => $plugin->getVersion(),
            'latestVersion' => $plugin->getUpgradeVersion(),
            'iconRaw' => $plugin->getIcon(),
            'installedAt' => $plugin->getInstalledAt(),
            'active' => $plugin->getActive(),
            'type' => ExtensionStruct::EXTENSION_TYPE_PLUGIN,
            'isTheme' => $isTheme,
            'configurable' => $this->configurationService->checkConfiguration(sprintf('%s.config', $plugin->getName())$context),
            'updatedAt' => $plugin->getUpgradedAt(),
            'allowDisable' => true,
        ];

        


        if (!$license instanceof License) {
            return ShopwareEdition::CE;
        }

        $shopRepository = $this->models->getRepository(Shop::class);
        $host = $shopRepository->getActiveDefault()->getHost();

        try {
            return $this->licenseUnpackService->evaluateLicense(
                new LicenseUnpackRequest($license->getLicense()$host)
            )->edition;
        } catch (RuntimeException $e) {
            return ShopwareEdition::CE;
        }
    }
}

class MetadataTest extends TestCase
{
    public function testFromXml(): void
    {
        $manifest = Manifest::createFromXmlFile(__DIR__ . '/../_fixtures/test/manifest.xml');

        $metaData = $manifest->getMetadata();
        static::assertEquals('test', $metaData->getName());
        static::assertEquals('shopware AG', $metaData->getAuthor());
        static::assertEquals('(c) by shopware AG', $metaData->getCopyright());
        static::assertEquals('MIT', $metaData->getLicense());
        static::assertEquals('https://test.com/privacy', $metaData->getPrivacy());
        static::assertEquals('1.0.0', $metaData->getVersion());
        static::assertEquals('icon.png', $metaData->getIcon());

        static::assertEquals([
            'en-GB' => 'Swag App Test',
            'de-DE' => 'Swag App Test',
        ]$metaData->getLabel());
        static::assertEquals([
            'en-GB' => 'Test for App System',
            'de-DE' => 'Test für das App System',
        ],

    private function getThemeDefinition(Theme $theme)
    {
        return [
            'template' => $theme->getTemplate(),
            'name' => $theme->getName(),
            'author' => $theme->getAuthor(),
            'license' => $theme->getLicense(),
            'description' => $theme->getDescription(),
            'version' => 3,
            'esi' => true,
            'style' => true,
            'emotion' => true,
        ];
    }

    /** * Removes the database entries for themes which file no more exist. * * @throws \Doctrine\ORM\OptimisticLockException * @throws \Doctrine\ORM\ORMInvalidArgumentException */
$version = $info->getVersion();

            // default branches are normalized to alias internally @see https://github.com/composer/composer/blob/95dca79fc2e18c3a4e33f207c1fcaa7d5b559400/src/Composer/Package/Locker.php#L353,             // when showing the version name, they will be normalized back to real name of the alias @see https://github.com/composer/composer/blob/95dca79fc2e18c3a4e33f207c1fcaa7d5b559400/src/Composer/Command/ShowCommand.php#L752             if ($version === VersionParser::DEFAULT_BRANCH_ALIAS && $info instanceof AliasPackage) {
                $version = $info->getAliasOf()->getVersion();
            }

            $pluginVersion = $this->versionSanitizer->sanitizePluginVersion($version);
            $extra = $info->getExtra();
            $license = $info->getLicense();
            $pluginIconPath = $extra['plugin-icon'] ?? 'src/Resources/config/plugin.png';

            $pluginData = [
                'name' => $pluginFromFileSystem->getName(),
                'baseClass' => $baseClass,
                'composerName' => $info->getName(),
                'path' => (new Filesystem())->makePathRelative($pluginPath$this->projectDir),
                'author' => $this->getAuthors($info),
                'copyright' => $extra['copyright'] ?? null,
                'license' => implode(', ', $license),
                'version' => $pluginVersion,
                
Home | Imprint | This part of the site doesn't use cookies.